home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 2001 January / CT_SW0101.ISO / pc / software / kommunik / multimed / snakcarb.sit / Snak 4.6.3 Carbon / Scripts / purepak.irc < prev    next >
Text File  |  2001-03-20  |  108KB  |  3,413 lines

  1.  
  2. # Snak adaptation 1.1. Removed handlers that emit conflicting messages and usually made '-'
  3. # Snak adaptation 1.2. Removed unnecessary checks for the correctness of ischanop
  4. # Snak adaptation 1.3. Removed pp.snm and calls to it as Snak does integrated highlighting
  5. # Snak adaptation 1.4. Removed pp.formecho in priv msg and notice handlers as it conflicts with normal message formatting
  6. #                       Removed //who when joining channel and message formatting in /who handler
  7. #                       Removed handlers for mesages 432 and 433 as Snak already does this
  8. #                       Removed message in notify_signon, and made it let Snak continue processing
  9. #                       Change order of handler and exec because execs are handled directly - not handed to the OS
  10. #                       The wait -CMD %<process> returns immediately as true
  11. #                       Removed CTCP handlers for ping, version, finger as Snak already does this
  12. #                       Modified dcc.ucmd.offer so that it asks properly for one or more files
  13. #                       dcc.ucmd.offer uses a variation on /input which asks for files
  14. #                       Because Mac files can contain spaces, the resulting list is separated by tabs, so 
  15. #                       a new function "listitem" is used instead of "word"
  16. #                      Removed fileexist from pp-dcc.irc alias and made a built in function
  17. #                       "Press ENTER to continue" in doechos removed..Snak can scoll.
  18. #                       /dcc save <file> saves package file in the scripts directory
  19. #                       /dcc notice now only sends to the current channel, not all channels.
  20. # Snak adaptation 1.5  the fileserver (/pphelp dcc) now works. Most changes consists of using listitem instead of word
  21. # Snak adaptation 1.6  Snak does its own DCC Autoaccept
  22. #                        Furthermore, the purepak dcc code does not always work because it assumes that there are no spaces 
  23. #                      in the filename. If there is then $6 will be incorrect and the script fails.
  24. #
  25. # To automatically load this into a connection, add "/load purepak.irc" to the startup actions.
  26. #
  27. # ########################################################################## #
  28. #                      PurePak - The sequel to TextBox                       #
  29. #                          A -+ TEXT +- production                           #
  30. # ########################################################################## #
  31. # Author: Crypt Keeper [ckeeper@axiom.access.one.net] (CKeeper on IRC)
  32. # Version 2.07
  33. #
  34. # This script requires at least ircII2.2.9 (Unix) or a fully ircII compatible
  35. # client.  It has only been tested under Unix with ircII2.2.9 and ircII2.8.2.
  36. #
  37. # If you edit this file, you must edit it with a Unix text editor or use
  38. # utilities like dos2unix/unix2dos to convert it to DOS to edit and then
  39. # back to Unix.  If it is edited in a DOS text editor it will be corrupted.
  40. #
  41. # All stolen code is labelled.  If it isn't labelled as stolen code, then it
  42. # is mine.  If you take my code, please give me credit.
  43. #
  44. # PurePak version 2.07 IRC script
  45. # Copyright (C) 1995
  46. #
  47. # This program is free software; you can redistribute it and/or modify
  48. # it under the terms of the GNU General Public License as published by
  49. # the Free Software Foundation; either version 1, or (at your option)
  50. # any later version.
  51. #
  52. # This program is distributed in the hope that it will be useful,
  53. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  54. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  55. # GNU General Public License for more details.
  56. #
  57. # You should have received a copy of the GNU General Public License
  58. # along with this program; if not, write to the Free Software
  59. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  60. # ########################################################################## #
  61.  
  62. ^set novice off
  63. ^set exec_protection off
  64. ^set input_protection off
  65. @ PPVERS = [2.07]
  66.  
  67. # ----------------------------------------------------------------------------
  68. # Sets and key bindings
  69. # ----------------------------------------------------------------------------
  70.  
  71. # See if we're on an EPIC client
  72. EVAL ^if (match(*EPIC* $status_user)) {@ PP.EPIC = 1}
  73.  
  74. EVAL ^set input_prompt [PurePak] version $PPVERS loading...
  75.  
  76. ^set tab on
  77. ^set tab_max 6
  78. ^set send_ignore_msg off
  79. ^set clock_24hour off
  80. ^set clock on
  81. ^set status_away  (away)
  82. ^set user_information [PurePak]
  83. ^set status_user [Lag ??] [PurePak] *
  84. ^set status_query  [Query: %Q]
  85. ^set status_notify  [Activity: %F]
  86. ^set status_oper *
  87. ^set status_overwrite  (overtype)
  88. ^set status_window ^^^^^^^^
  89. ^set status_mode  (+%+)
  90. ^set status_mail  [Mail: %M]
  91. ^set status_server  via %S
  92. ^set channel_name_width 10
  93. ^set debug 0
  94. ^set help_window off
  95. ^set help_prompt on
  96. ^set hold_mode_max 0
  97. ^set input_aliases off
  98. ^set insert_mode on
  99. ^set lastlog 16384
  100. ^set lastlog_level all
  101. ^set scroll on
  102. ^set scroll_lines 1
  103. ^set shell_limit 0
  104. ^set status_hold_lines  (%B)
  105. ^set command_mode off
  106. ^set double_status_line off
  107. ^set suppress_server_motd off
  108. ^set show_end_of_msgs off
  109. ^set beep_when_away 0
  110. EVAL ^set client_information [PurePak] v$PPVERS by Crypt Keeper
  111. ^set status_hold  -- ENTER --
  112. ^set beep_max 2
  113. ^set warn_of_ignores on
  114. ^set verbose_ctcp off
  115. ^set indent on
  116. ^set auto_whowas off
  117. ^set full_status_line on
  118. ^set continued_line  
  119. ^set hide_private_channels off
  120. ^set show_away_once on
  121. ^set history 120
  122. ^set auto_unmark_away off
  123. ^set beep_on_msg NONE
  124. ^set show_channel_names on
  125. ^set show_numerics off
  126. ^set max_recursions 210
  127. ^set log off
  128. ^set logfile irc.log
  129. ^set input_protection off
  130. ^set dcc_block_size 1024
  131. ^set no_ctcp_flood on
  132. ^EVAL ^if ([$mail] == [0]) {^set mail 1}
  133. ^EVAL ^set load_path ~/purepak:./purepak:~:$load_path
  134. ^set hold_mode off
  135. ^set notify_on_termination off
  136. ^set show_who_hopcount off
  137. ^set flood_warning off
  138. ^set flood_rate 1
  139. ^set flood_after 4
  140. ^set flood_users 4
  141. ^EVAL ^set status_format %T %*%@%N%#%Q%S%H%B%A%C%+%I%O%F %W%>%U%M%X%Y%Z 
  142.  
  143. bind ^X meta2
  144. bind ^\ switch_channels
  145. bind ^Q quote_character
  146. bind ^I parse_command ^tk.getmsg 1 $tk.msglist
  147. bind ^R parse_command ^tk.getmsg -1 $tk.msglist
  148. bind ^X^X parse_command tk.delnick
  149. bind ^S toggle_stop_screen
  150. bind ^[ meta1
  151. bind meta1-[ meta2
  152. bind meta1-O meta2
  153. bind meta2-^@ scroll_end
  154. bind meta2-A backward_history
  155. bind meta2-B forward_history
  156. bind meta2-C forward_character
  157. bind meta2-D backward_character
  158. bind meta2-5 parse_command ^s_up
  159. bind meta2-6 parse_command ^s_dn
  160. bind meta2-1 parse_command ^s_end
  161. bind meta2-7 parse_command ^s_end
  162. bind ^X^A scroll_backward
  163. bind ^X^B scroll_forward
  164. bind ^B self_insert
  165. bind ^_ self_insert
  166. bind ^V self_insert
  167. bind ^A self_insert
  168. bind ^O self_insert
  169. bind ^W next_window
  170. bind ^Z stop_irc
  171. bind ^U erase_line
  172.  
  173. alias s_up {
  174.     ^bind ~ nothing
  175.     ^type ^U^X^A^U
  176.     ^timer 1 ^bind ~ self_insert
  177. }
  178. alias s_dn {
  179.     ^bind ~ nothing
  180.     ^type ^U^X^B^U
  181.     ^timer 1 ^bind ~ self_insert
  182. }
  183. alias s_end {
  184.     ^bind ~ nothing
  185.     ^type ^[[^@
  186.     ^timer 1 ^bind ~ self_insert
  187. }
  188.  
  189. # File that settings are saved to
  190. @ PP.SAVEFILE = [purepak.sav]
  191.  
  192. on ^dcc_raw * {}
  193.  
  194. # ----------------------------------------------------------------------------
  195. # Tab key message history (originally from the ircII tabkey script)
  196. # ----------------------------------------------------------------------------
  197.  
  198. alias tk.addmsg {
  199.     @ tk.matched = rmatch($0 $^\1-)
  200.     if (tk.matched)
  201.     {
  202.         @ tk.msglist = [$(0-${tk.matched-1}) $(${tk.matched+1}-)]
  203.     }
  204.     { @ tk.msglist = [$(0-${tk.msgmax-1})] }
  205.     @ tk.msgcnt = 0
  206.     ^assign -tk.matched
  207. }
  208. alias tk.getmsg {
  209.     @ tk.msgcnt = tk.msgcnt + [$0]
  210.     if ( #tk.msglist < tk.msgcnt ) {@ tk.msgcnt = 1}
  211.     if (tk.msgcnt <= 0) {@ tk.msgcnt =  #tk.msglist}
  212.     @ tk.junk = K ## [msg]
  213.     type ^U$tk.junk $^^{[$($tk.msgcnt)]} 
  214. }
  215. alias tk.delnick {
  216.     if (tk.msgcnt == 0)
  217.     {
  218.         echo *** Nickname: $word(0 $tk.msglist) removed.
  219.         @ tk.msglist = [$notword(1 $tk.msglist)]
  220.     }
  221.     {
  222.         echo *** Nickname: $word(${tk.msgcnt-1} $tk.msglist) removed.
  223.         @ tk.msglist = [$notword($tk.msgcnt $tk.msglist)]
  224.     }
  225.     type ^U
  226. }
  227. alias notword {
  228.     if ([$0]>0)
  229.     {
  230.         if (([$0]>1)&&([$0] < rmatch($~ $1-))) {@ nw.sep = [ ]} {@ nw.sep = []}
  231.         @ function_return = [$(1-${[$0]-1})] ## [$nw.sep] ## [$(${[$0]+1}-)]
  232.     } {@ function_return = [$1-]}
  233. }
  234. alias minnot {
  235.     @ noticecnt = 0
  236.     ^assign -lastnoter
  237.     ^assign -ntemp
  238. }
  239.  
  240. # ----------------------------------------------------------------------------
  241. # Miscellaneous functions and aliases, mostly internal
  242. # ----------------------------------------------------------------------------
  243.  
  244. # Lame aliases for buggy clients
  245. alias say {
  246.     quote PRIVMSG $C :$*
  247.     echo <${N}> $*
  248. }
  249. alias sendto {
  250.     if (ischannel($0)) {^if ([$0] == C) {/echo <${N}> $1-} {/echo -> $0 <${N}> $1-}} {/echo -> [$0] $1-}
  251.     ^quote PRIVMSG $0 :$1-
  252. }
  253.  
  254. # /me alias that echoes to the right window (some clients don't)
  255. #alias me {
  256. #    xecho -LEVEL CRAP -WINDOW $winnum() * $N $*
  257. #    quote PRIVMSG $C :ACTION $*
  258. #}
  259.  
  260. # Repeats $1 $0 times
  261. alias repeatcmd {
  262.     @ RCOUNT = 0
  263.     while (RCOUNT < [$0])
  264.     {
  265.         @ RCOUNT = RCOUNT + 1
  266.         $1-
  267.     }
  268.     ^assign -RCOUNT
  269. }
  270.  
  271. alias nickonly {@ FUNCTION_RETURN = left($index(! $0) $0)}
  272. alias safestr {@ FUNCTION_RETURN = strip(\;\$ $*)}
  273.  
  274. # Returns 1 if you have ops on $0, 0 if you don't.  We use an alias instead
  275. # of ischanop() since ischanop doesn't always return a correct result on
  276. # older clients, and if ischanop were to say that you are not opped when you
  277. # really are, your protection stuff wouldn't go off.
  278. alias gotops {
  279.     @ FUNCTION_RETURN = 0
  280.     if ([$0] == C) {^if (P == [@]) {@ FUNCTION_RETURN = 1}}
  281.     {^if (ischanop($N $0)) {@ FUNCTION_RETURN = 1}}
  282. }
  283.  
  284. # Returns a random letter/number string
  285. @ PP.RC = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789a]
  286. alias randcrap {
  287.     @ RC = 1
  288.     while (RC < [$0])
  289.     {
  290.         @ RC = RC + 1
  291.         @ RS = mid($rand(62) 1 $PP.RC)##RS
  292.     }
  293.     @ RS = mid($rand(25) 1 $PP.RC)##RS
  294.     @ FUNCTION_RETURN = RS
  295.     ^assign -RS
  296.     ^assign -RC
  297. }
  298.  
  299. # Returns true if a string contains letters
  300. alias isalpha {
  301.     if (rmatch($0 *a* *b* *c* *d* *e* *f* *g* *h* *i* *j* *k* *l* *m* *n* *o* *p* *q* *r* *s* *t* *u* *v* *w* *x* *y* *z*)) {@ FUNCTION_RETURN = 1}
  302.     {@ FUNCTION_RETURN = 0}
  303. }
  304.  
  305. # delword <word> <list> (output returned in NLIST)
  306. # recursive alias that deletes a word from a list
  307. alias delword {
  308.     if ([$1] != [$0]) {^assign NLIST $1 $NLIST}
  309.     if ([$2]) {^delword $0 $2-}
  310. }
  311.  
  312. # Check is user is friended/shitted
  313. # ispal/isshit <n!u@h> <#channel>
  314. alias ispal {
  315.     @ FUNCTION_RETURN = 0
  316.     foreach PP.FRIENDS XZ {
  317.         if (match($decode($XZ) $1))
  318.         {
  319.             if (rmatch($0 $PP.FRIENDS[$XZ])) {@ FUNCTION_RETURN = 1}
  320.         }
  321.     }
  322.     ^assign -XZ
  323. }
  324. alias isshit {
  325.     @ FUNCTION_RETURN = 0
  326.     foreach PP.ENEMIES XZ {
  327.         if (match($decode($XZ) $1))
  328.         {
  329.             if (rmatch($0 $PP.ENEMIES[$XZ])) {@ FUNCTION_RETURN = 1}
  330.         }
  331.     }
  332.     ^assign -XZ
  333. }
  334.  
  335. # The pager for long displays, such as in help.
  336. # We do it like this so it doesn't use the old $"-MORE-" method
  337. # which is outdated and causes problems on newer clients.
  338. alias pp.pauseset {
  339.     @ ECCTR = 0
  340.     ^alias echo {
  341.         @ EC[$ECCTR] = [$*]
  342.         @ ECCTR = ECCTR + 1
  343.     }
  344. }
  345. alias pp.pauseend {
  346.     ^alias -echo
  347.     @ ECTR = 0
  348.     ^pp.doechos
  349. }
  350. # Snak adaptation 1.4. Removed check for numlines and "Press ENTER.." input. Snak can scroll...
  351. alias pp.doechos {
  352.     @ LCTR = 0
  353. #    while ((ECTR < ECCTR)&&(LCTR < PP.SET.NUMLINES))
  354.     while (ECTR < ECCTR)
  355.     {
  356.         @ LCTR = LCTR + 1
  357.         echo $EC[$ECTR]
  358.         ^assign -EC[$ECTR]
  359.         @ ECTR = ECTR + 1
  360.     }
  361. #    if ((LCTR >= PP.SET.NUMLINES)&&(ECTR < ECCTR)) {^input "** Press ENTER to continue **" ^pp.doechos}
  362. #    {
  363.         ^assign -LCTR
  364.         ^assign -ECTR
  365.         ^assign -ECCTR
  366.         foreach EC AA {^assign -EC[$AA]}
  367. #    }
  368. }
  369.  
  370. # ----------------------------------------------------------------------------
  371. # Default settings if purepak.sav doesn't exist
  372. # ----------------------------------------------------------------------------
  373.  
  374. # Letters in main settings variable (PP.SET): (this variable is about full)
  375. #   I - Auto-ignore on msg/notice/ctcp floods
  376. #   F - Flood filtering
  377. #   A - Ascii art kicker
  378. #   N - Nick flood protection
  379. #   E - Use enemies list
  380. #   L - Use friends list
  381. #   O - Let everyone know when you are set away
  382. #   G - Log messages and important stuff while away
  383. #   W - Send notices and/or warnings to people
  384. #   J - Auto rejoin on kick
  385. #   M - Mass deop/kick protection
  386. #   K - Channel key flash protection
  387. #   B - Ban protection
  388. #   X - Ignore CTCP PING
  389. #   Y - Ignore CTCP VERSION
  390. #   Z - Ignore CTCP FINGER
  391. #   S - Automatic deop on server ops
  392. #   H - Write awaylog to a file (PP.SET.ALFILE)
  393. #   C - Clonebot mass-join protection
  394. #   Q - Beep on private messages
  395. #   P - Auto-unload help
  396. #   V - Desynched user notification
  397. @ PP.SET = [CGFENLOWJMKBZPV]
  398.  
  399. # Response to mass deop/kick (0 = deop, 1 = kick)
  400. @ PP.SET.MASSRESP = 0
  401. # Auto-ignoring - number of seconds to autoignore
  402. @ PP.SET.IGSECS = 30
  403. # Short kill notice displays
  404. @ PP.SET.SHORTKILLS = 1
  405. # Server notice settings
  406. @ PP.SET.NOTELEVELS = [KUFNMC]
  407. # Nick flood protection sensitivity
  408. @ PP.SET.NFSENS = 3
  409. # Length of the first word in a message for it to be a junkflood
  410. @ PP.SET.JFLEN = 200
  411. # Away log file
  412. @ PP.SET.ALFILE = [away.log]
  413. # Exec commands to do various things
  414. @ PP.SET.FINGERCMD = [finger]
  415. @ PP.SET.LSCMD = [ls -l]
  416. @ PP.SET.LSWCMD = [ls -xp]
  417. @ PP.SET.RMCMD = [rm -f]
  418. @ PP.SET.MAILCMD = [mail]
  419. @ PP.SET.UUECMD = [uuencode]
  420. @ PP.SET.CATCMD = [cat]
  421. @ PP.SET.PSCMD = [ps -uxw]
  422. @ PP.SET.KILLCMD = [kill -KILL]
  423. @ PP.SET.UNGZCMD = [gunzip -c]
  424. @ PP.SET.UNZCMD = [uncompress -c]
  425. @ PP.SET.MKNODCMD = [mknod]
  426. @ PP.SET.NSLOOKCMD = [host]
  427. # Counter variable for awaylog
  428. @ PP.AWAYLCTR = 0
  429. # Minutes of idle-time to be set auto-away (0 disables)
  430. @ PP.SET.AUTOAWAY = 0
  431. # Clonebot mass-join sensitivity (number that must join in a 4 second span
  432. @ PP.SET.CPSENS = 3
  433. # NSLOOKUP on join for IP addresses
  434. @ PP.SET.LOOKJOIN = 1
  435. # Counter for clonebot mass-join detector
  436. @ PP.CPCTR = 0
  437. # Number of lines of output before a pause on help, playback, etc.
  438. @ PP.SET.NUMLINES = 22
  439. # Scripts we should auto-load:
  440. # K = Kicks, X = DCC, B = Bots, S = Silly, W = War
  441. @ PP.SET.AUTOLOAD = [XBS]
  442. # This is set to 1 after the first motd is seen
  443. @ PP.SEENMOTD = 0
  444. # Msg/notice formats
  445. @ PP.SET.MRFORMAT = encode([N!U] M)
  446. @ PP.SET.NRFORMAT = encode(-N- M)
  447. @ PP.SET.MSFORMAT = encode(-> [N] M)
  448. @ PP.SET.NSFORMAT = encode(-> -N- M)
  449. # Channel protection
  450. @ PP.SET.CHANPROT = 1
  451. # Show people as they signoff in splits
  452. @ PP.SET.SHOWSPLITTERS = 0
  453. # Suppress startup messages
  454. @ PP.SET.NOSTARTUP = 0
  455. # Insert random ?'s into bans
  456. @ PP.SET.FUNKYBANS = 1
  457. # Beep on netsplits
  458. @ PP.SET.BSP = 1
  459. # Allow CTCP PAGE
  460. @ PP.SET.CTCPPAGE = 1
  461. # Print time every 10 minutes
  462. @ PP.SET.TP = 0
  463. # Nick to match public
  464. @ PP.SET.PMATCH = [.]
  465.  
  466. # Msg/notice format settings to look like other scripts
  467. @ PP.MR.DEFAULT = encode([N!U] M)
  468. @ PP.MS.DEFAULT = encode(-> [N] M)
  469. @ PP.NR.DEFAULT = encode(-N- M)
  470. @ PP.NS.DEFAULT = encode(-> -N- M)
  471. @ PP.MR.IRCII = encode(*N* M)
  472. @ PP.MS.IRCII = encode(-> *N* M)
  473. @ PP.NR.IRCII = encode(-N- M)
  474. @ PP.NS.IRCII = encode(-> -N- M)
  475. @ PP.MR.TEXTBOX = encode(*N* M)
  476. @ PP.MS.TEXTBOX = encode(-> *N* M)
  477. @ PP.NR.TEXTBOX = encode(-N- M)
  478. @ PP.NS.TEXTBOX = encode(-> -N- M)
  479. @ PP.MR.LICE = encode([N!U] M)
  480. @ PP.MS.LICE = encode([*N*] M)
  481. @ PP.NR.LICE = encode(-N!U- M)
  482. @ PP.NS.LICE = encode([-N-] M)
  483. @ PP.MR.PHOENIX = encode([N:U] M)
  484. @ PP.MS.PHOENIX = encode(<-[N]-> M)
  485. @ PP.NR.PHOENIX = encode(-N- M)
  486. @ PP.NS.PHOENIX = encode(-> -N- M)
  487.  
  488. # ----------------------------------------------------------------------------
  489. # /pp alias to set script options
  490. # ----------------------------------------------------------------------------
  491.  
  492. # Other script parts (the pp-*.irc scripts) can add to this array and have
  493. # their settings under /pp
  494. @ PP.SETCHECKS.M = [^pp.set.m]
  495.  
  496. alias pp.set.bstatus {^if ([$0]) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  497. alias pp.set.tstatus {^if (index($0 $PP.SET) >= 0) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  498. alias pp.set.changetoggle {
  499.     if ([$1])
  500.     {
  501.         if ([$1] == [OFF]) {@ PP.SET = strip($0 $PP.SET)}
  502.         {^if (index($0 $PP.SET) < 0) {@ PP.SET = [$0]##PP.SET}}
  503.     }
  504. }
  505. # Snak adaptation 1.4. Snak already handles this
  506. alias pp.set.setupctcp {
  507. #    if (index(X $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**PING**"} {^on ^raw_irc "% PRIVMSG % :**PING**" {}}
  508. #    if (index(Y $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**VER**"} {^on ^raw_irc "% PRIVMSG % :**VER**" {}}
  509. #    if (index(Z $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**FINGER**"} {^on ^raw_irc "% PRIVMSG % :**FINGER**" {}}
  510. }
  511. alias pp.set.onoff {^if ([$0]) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  512.  
  513. alias status {
  514.     ^pp.pauseset
  515.     echo -- Current PurePak settings:
  516.     echo -- ===========================================================================
  517.     echo -- Automatic flood ignoring (AIGnore)                      : $pp.set.tstatus(I)
  518.     echo -- Filtering of known floods (FFILTer)                     : $pp.set.tstatus(F)
  519.     echo -- ASCII art kicker (ARTKick)                              : $pp.set.tstatus(A)
  520.     echo -- Kicking on kick flood (NFProt)                          : $pp.set.tstatus(N)
  521.     echo -- Use of enemies list (ENEMies)                           : $pp.set.tstatus(E)
  522.     echo -- Use of friends list (FRIends)                           : $pp.set.tstatus(L)
  523.     echo -- Public announcement of away status (AWAYNotices)        : $pp.set.tstatus(O)
  524.     echo -- Logging of msgs/events while away (AWAYLogging)         : $pp.set.tstatus(G)
  525.     echo -- Logging to an away log file (AWAYWriting)               : $pp.set.tstatus(H)
  526.     echo -- Name of away log file (AFILE)                           : ${PP.SET.ALFILE}
  527.     echo -- General miscellaneous warnings/notices (NOTIces)        : $pp.set.tstatus(W)
  528.     echo -- Automatic rejoining on kick (KREJoin)                   : $pp.set.tstatus(J)
  529.     echo -- Mass deop/kick protection (MASSProt)                    : $pp.set.tstatus(M)
  530.     if (PP.SET.MASSRESP) {
  531.     echo -- Action taken on mass deop/kick (MASSAction)             : KICK
  532.     } {
  533.     echo -- Action taken on mass deop/kick (MASSAction)             : DEOP
  534.     }
  535.     echo -- Channel protection (CHANprot)                           : $pp.set.onoff($PP.SET.CHANPROT)
  536.     echo -- Automatic removal of server ops (SERVOP)                : $pp.set.tstatus(S)
  537.     echo -- Channel key flash protection (KEYProt)                  : $pp.set.tstatus(K)
  538.     echo -- Ban defense (BANDefense)                                : $pp.set.tstatus(B)
  539.     echo -- Ignoring of CTCP PINGs (PING)                           : $pp.set.tstatus(X)
  540.     echo -- Ignoring of CTCP FINGERs (FINGer)                       : $pp.set.tstatus(Z)
  541.     echo -- Ignoring of CTCP VERSIONs (VERsion)                     : $pp.set.tstatus(Y)
  542.     echo -- Seconds to auto-ignore flooders (IGTime)                : ${PP.SET.IGSECS}
  543.     echo -- Nick flood protection sensitivity (NFSens)              : ${PP.SET.NFSENS}
  544.     echo -- Length of first word for a msg to be junkflood (JFLEN)  : ${PP.SET.JFLEN}
  545.     echo -- Desynched user notification (DESynchnote)               : $pp.set.tstatus(V)
  546.     echo -- Beeping on private messages (MSGBeep)                   : $pp.set.tstatus(Q)
  547.     if (PP.SET.AUTOAWAY) {
  548.     echo -- Minutes of idle time before being set away (AUTOAway)   : ${PP.SET.AUTOAWAY}
  549.     } {
  550.     echo -- Minutes of idle time before being set away (AUTOAway)   : OFF
  551.     }
  552.     echo -- NS lookup of IP adresses on join                        : $pp.set.onoff($PP.SET.LOOKJOIN)
  553.     echo -- Clonebot mass-join protection (CLONEProt)               : $pp.set.tstatus(C)
  554.     echo -- Clonebot mass-join protection sensitivity (CLONESens)   : ${PP.SET.CPSENS}
  555.     if (suppress_server_motd == [ON])
  556.     {
  557.     echo -- Server motd display at startup (MOTD)                   : OFF
  558.     } {
  559.     echo -- Server motd display at startup (MOTD)                   : ON
  560.     }
  561.     echo -- Show users who join/signoff in splits (SHOWSPLITters)   : $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  562.     echo -- Number of rows on this display (ROWS)                   : ${PP.SET.NUMLINES + 2}
  563.     echo -- Auto-loading of pp-bots.irc (LOADBots)                  : $pp.set.sload(B)
  564.     echo -- Auto-loading of pp-xdcc.irc (LOADXdcc)                  : $pp.set.sload(X)
  565.     echo -- Auto-loading of pp-silly.irc (LOADSilly)                : $pp.set.sload(S)
  566.     echo -- Auto-loading of pp-war.irc (LOADWar)                    : $pp.set.sload(W)
  567.     echo -- Auto-loading of pp-kicks.irc (LOADKicks)                : $pp.set.sload(K)
  568.     echo -- Suppression of script startup screens                   : $pp.set.onoff($PP.SET.NOSTARTUP)
  569.     echo -- Insert random ?'s into bans (FUNkybans)                 : $pp.set.onoff($PP.SET.FUNKYBANS)
  570.     echo -- Beep on netsplits (BEEPSPLIT)                           : $pp.set.onoff($PP.SET.BSP)
  571.     echo -- CTCP PAGE (PAGE)                                        : $pp.set.onoff($PP.SET.CTCPPAGE)
  572.     echo -- Print time every 10 minutes (TPRINT)                    : $pp.set.onoff($PP.SET.TP)
  573.     echo -- String to match and highlight in public (PMATCH)        : ${PP.SET.PMATCH}
  574.     echo -- ===========================================================================
  575.     ^pp.pauseend
  576. }
  577.  
  578. alias pp.set.sload {
  579.     if ([$1])
  580.     {
  581.         if ([$1] == [ON])
  582.         {
  583.             if (index($0 $PP.SET.AUTOLOAD) < 0) {@ PP.SET.AUTOLOAD = PP.SET.AUTOLOAD##[$0]}
  584.             pp.autoload
  585.         } {@ PP.SET.AUTOLOAD = strip($0 $PP.SET.AUTOLOAD)}
  586.     } {^if (index($0 $PP.SET.AUTOLOAD) >= 0) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  587. }
  588. alias pp.autoload {
  589.     if ((index(K $PP.SET.AUTOLOAD) >= 0)&&(!(PP.KICKS))) {/load pp-kicks.irc}
  590.     if ((index(B $PP.SET.AUTOLOAD) >= 0)&&(!(PP.BOTS))) {/load pp-bots.irc}
  591.     if ((index(S $PP.SET.AUTOLOAD) >= 0)&&(!(PP.SILLY))) {/load pp-silly.irc}
  592.     if ((index(X $PP.SET.AUTOLOAD) >= 0)&&(!(PP.DCC))) {/load pp-dcc.irc}
  593.     if ((index(W $PP.SET.AUTOLOAD) >= 0)&&(!(PP.WAR))) {/load pp-war.irc}
  594. }
  595.  
  596. alias pp.set.setmformat {
  597.     echo *** Special characters in msg/notice outgoing display formats:
  598.     echo ***   N = Nickname of person you are sending to
  599.     echo ***   M = Text of the message you are sending
  600.     echo ***   T = Current time
  601.     echo *** Special characters in msg/notice incoming display formats:
  602.     echo ***   N = Nickname of the person who sent the msg/notice
  603.     echo ***   U = User@host of sender
  604.     echo ***   M = Text of message
  605.     echo ***   T = Current time
  606.     echo *** ^V,^B,^O,^_ control characters can also be used
  607.     echo ***
  608.     echo *** You may enter new formats for any of these, or press enter for no
  609.     echo *** change.
  610.     echo ***
  611.     echo *** Current incoming message format is: $decode($PP.SET.MRFORMAT)
  612.     ^input "New incoming message format or enter for no change >>" if (1) {
  613.         if ([$0]) {@ PP.SET.MRFORMAT = encode($*)}
  614.         echo *** Current outgoing message format is: $decode($PP.SET.MSFORMAT)
  615.         ^input "New outgoing message format or enter for no change >>" if (1) {
  616.             if ([$0]) {@ PP.SET.MSFORMAT = encode($*)}
  617.             echo *** Current incoming notice format is: $decode($PP.SET.NRFORMAT)
  618.             ^input "New incoming notice format or enter for no chaange >>" if (1) {
  619.                 if ([$0]) {@ PP.SET.NRFORMAT = encode($*)}
  620.                 echo *** Current outgoing notice format is: $decode($PP.SET.NSFORMAT)
  621.                 ^input "New outgoing notice format or enter for no change >>" if (1) {
  622.                     if ([$0]) {@ PP.SET.NSFORMAT = encode($*)}
  623.                     echo ***
  624.                     echo *** Message formats are now set to:
  625.                     echo *** Incoming message: $decode($PP.SET.MRFORMAT)
  626.                     echo *** Outgoing message: $decode($PP.SET.MSFORMAT)
  627.                     echo *** Incoming notice: $decode($PP.SET.NRFORMAT)
  628.                     echo *** Outgoing notice: $decode($PP.SET.NSFORMAT)
  629.                     echo ***
  630.                     echo *** If you have made changes, you must save with /sve for your changes
  631.                     echo *** to become permanent.
  632.                 }
  633.             }
  634.         }
  635.     }
  636. }
  637.  
  638. # *** Main script settings:
  639. # AIGnore = Automatic flood ignoring
  640. # FFILTer = Filtering of known floods
  641. # ARTKick = ASCII art kicker
  642. # NFProt = Kicking on nick flood
  643. # ENEMies = Use of enemies list
  644. # FRIends = Use of friends list
  645. # AWAYNotices = Public announcement of away status
  646. # AWAYLogging = Logging of msgs/events while away
  647. # AWAYWriting = Logging to an away log file
  648. # AFILE = Name of away log file
  649. # NOTIces = General warnings/notices
  650. # KREJoin = Automatic rejoining on kick
  651. # MASSProt = Mass deop/kick protection
  652. # MASSAction = Action taken on mass deop/kick
  653. # SERVOP = Automatic removal of server ops
  654. # KEYProt = Channel key flash protection
  655. # BANDefense = Ban defense
  656. # PING = Ignoring of CTCP PING
  657. # FINGer = Ignoring of CTCP FINGER
  658. # VERsion = Ignoring of CTCP VERSION
  659. # IGTime = Seconds to auto-ignore flooders
  660. # NFSens = Sensitivity of nick flood protection (higher values more sensitive)
  661. # JFLEN = First word length for a message to be a junkflood
  662. # *CMD = Correspond with PP.SET.*CMD above
  663. # MSGBeep = Beep on private messages
  664. # AUTOAway = Minutes of idle-time to be automaticly set away
  665. # CLONEProt = Clonebot mass-join protection
  666. # CLONESens = Sensitivity of clonebot mass-join protection (lower values more sensitive)
  667. # ROWS = Number of rows on display
  668. # LOADBots = Auto load pp-bots.irc
  669. # LOADWar = Auto load pp-war.irc
  670. # LOADSilly = Auto load pp-silly.irc
  671. # LOADKicks = Auto load pp-kicks.irc
  672. # LOADDcc = Auto load pp-dcc.irc
  673. # HELPUnload = Auto unloading of help
  674. # DESynchnote = Desynched user notification
  675. # WRITEMETHOD = /sve write method
  676. # MOTD = Server motd display at startup
  677. # MFORMAT = Msg/notice format settings
  678. # CHANprot = Channel protection
  679. # SHOWSPLITters = Show users who join/signoff in splits
  680. # LOOKJoin = NS lookup of IP adresses on join
  681. # NOSTARTUP = Suppression of startup screens
  682. # FUNkybans = Insert random ?'s into bans
  683. # BEEPSPLIT = Beep on netsplits
  684. # PAGE = CTCP PAGE
  685. # TPRINT = Print time every 10 minutes
  686. # PMATCH = String to match and highlight publicly
  687. alias pp.set.m {
  688.     if (rmatch($0 LOADK* LOADB* LOADW* LOADS* LOADD*))
  689.     {
  690.         if (match($1 ON OFF))
  691.         {
  692.             if (match(LOADB* $0)) {/pp.set.sload B $1}
  693.             if (match(LOADW* $0)) {/pp.set.sload W $1}
  694.             if (match(LOADS* $0)) {/pp.set.sload S $1}
  695.             if (match(LOADK* $0)) {/pp.set.sload K $1}
  696.             if (match(LOADD* $0)) {/pp.set.sload X $1}
  697.         }
  698.         if (match(LOADB* $0)) {/echo *** Auto-loading of pp-bots.irc is now $pp.set.sload(B)}
  699.         if (match(LOADW* $0)) {/echo *** Auto-loading of pp-war.irc is now $pp.set.sload(W)}
  700.         if (match(LOADS* $0)) {/echo *** Auto-loading of pp-silly.irc is now $pp.set.sload(S)}
  701.         if (match(LOADK* $0)) {/echo *** Auto-loading of pp-kicks.irc is now $pp.set.sload(K)}
  702.         if (match(LOADD* $0)) {/echo *** Auto-loading of pp-dcc.irc is now $pp.set.sload(X)}
  703.         @ VU = 1
  704.     }
  705.     if ([$0] == [PAGE])
  706.     {
  707.         if (match($1 ON OFF))
  708.         {
  709.             if ([$1] == [ON]) {@ PP.SET.CTCPPAGE = 1} {@ PP.SET.CTCPPAGE = 0}
  710.         }
  711.         echo *** CTCP PAGE response is now $pp.set.onoff($PP.SET.CTCPPAGE)
  712.         @ VU = 1
  713.     }
  714.     if ([$0] == [TPRINT])
  715.     {
  716.         if (match($1 ON OFF))
  717.         {
  718.             if ([$1] == [ON]) {@ PP.SET.TP = 1} {@ PP.SET.TP = 0}
  719.         }
  720.         echo *** Print time every 10 minutes is now $pp.set.onoff($PP.SET.TP)
  721.         @ VU = 1
  722.     }
  723.     if ([$0] == [BEEPSPLIT])
  724.     {
  725.         if (match($1 ON OFF))
  726.         {
  727.             if ([$1] == [ON]) {@ PP.SET.BSP = 1} {@ PP.SET.BSP = 0}
  728.         }
  729.         echo *** Beep on netsplits is now $pp.set.onoff($PP.SET.BSP)
  730.         @ VU = 1
  731.     }
  732.     if (match(LOOKJ* $0))
  733.     {
  734.         if (match($1 ON OFF))
  735.         {
  736.             if ([$1] == [ON]) {@ PP.SET.LOOKJOIN = 1} {@ PP.SET.LOOKJOIN = 0}
  737.         }
  738.         echo *** NS lookup of IP adresses on join is now $pp.set.onoff($PP.SET.LOOKJOIN)
  739.         @ VU = 1
  740.     }
  741.     if ([$0] == [NOSTARTUP])
  742.     {
  743.         if (match($1 ON OFF))
  744.         {
  745.             if ([$1] == [ON]) {@ PP.SET.NOSTARTUP = 1} {@ PP.SET.NOSTARTUP = 0}
  746.         }
  747.         echo *** Suppression of script startup screens is now $pp.set.onoff($PP.SET.NOSTARTUP)
  748.         @ VU = 1
  749.     }
  750.     if (match(FUN* $0))
  751.     {
  752.         if (match($1 ON OFF))
  753.         {
  754.             if ([$1] == [ON]) {@ PP.SET.FUNKYBANS = 1} {@ PP.SET.FUNKYBANS = 0}
  755.         }
  756.         echo *** Insert random ?'s into bans is now $pp.set.onoff($PP.SET.FUNKYBANS)
  757.         @ VU = 1
  758.     }
  759.     if (match(SHOWSPLIT* $0))
  760.     {
  761.         if (match($1 ON OFF))
  762.         {
  763.             if ([$1] == [ON]) {@ PP.SET.SHOWSPLITTERS = 1} {@ PP.SET.SHOWSPLITTERS = 0}
  764.         }
  765.         echo *** Showing of users who join/signoff in netsplits is now $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  766.         @ VU = 1
  767.     }
  768.     if ([$0] == [MFORMAT])
  769.     {
  770.         @ VU = 1
  771.         if ([$1])
  772.         {
  773.             if (match($1 IRCII TEXTBOX PHOENIX LICE DEFAULT))
  774.             {
  775.                 @ PP.SET.MRFORMAT = PP.MR[$1]
  776.                 @ PP.SET.NRFORMAT = PP.NR[$1]
  777.                 @ PP.SET.MSFORMAT = PP.MS[$1]
  778.                 @ PP.SET.NSFORMAT = PP.NS[$1]
  779.                 echo *** Your msgs/notices now look like: $toupper($1)
  780.             } {/echo *** /pp mformat [<ircii/textbox/phoenix/lice>]}
  781.         } {^pp.set.setmformat}
  782.     }
  783.     if (match(CHAN* $0))
  784.     {
  785.         if (match($1 ON OFF))
  786.         {
  787.             if ([$1] == [ON]) {@ PP.SET.CHANPROT = 1} {@ PP.SET.CHANPROT = 0}
  788.         }
  789.         echo *** Channel protection is now $pp.set.onoff($PP.SET.CHANPROT)
  790.         @ VU = 1
  791.     }
  792.     if (match(DES* $0))
  793.     {
  794.         ^pp.set.changetoggle V $1
  795.         echo *** Desynched user notification is now $pp.set.tstatus(V)
  796.         @ VU = 1
  797.     }
  798.     if (match(AIG* $0))
  799.     {
  800.         ^pp.set.changetoggle I $1
  801.         echo *** Auto-ignoring on msg/notice/ctcp/nick floods is now $pp.set.tstatus(I)
  802.         @ VU = 1
  803.     }
  804.     if ([$0] == [MOTD])
  805.     {
  806.         if (match($1 ON OFF))
  807.         {
  808.             if ([$1] == [ON]) {^set suppress_server_motd OFF} {^set suppress_server_motd ON}
  809.         }
  810.         if (suppress_server_motd == [ON]) {/echo *** Server motd display at startup is now OFF}
  811.         {/echo *** Server motd display at startup is now ON}
  812.         @ VU = 1
  813.     }
  814.     if (match(FFILT* $0))
  815.     {
  816.         ^pp.set.changetoggle F $1
  817.         echo *** Filtering of known floods in msgs/notices/public messages is now $pp.set.tstatus(F)
  818.         @ VU = 1
  819.     }
  820.     if (match(ARTK* $0))
  821.     {
  822.         ^pp.set.changetoggle A $1
  823.         echo *** ASCII art kicker is now $pp.set.tstatus(A)
  824.         @ VU = 1
  825.     }
  826.     if (match(HELPU* $0))
  827.     {
  828.         ^pp.set.changetoggle P $1
  829.         echo *** Automatic unloading of help information is now $pp.set.tstatus(P)
  830.         @ VU = 1
  831.     }
  832.     if (match(NFP* $0))
  833.     {
  834.         ^pp.set.changetoggle N $1
  835.         echo *** Kicking on nick flood is now $pp.set.tstatus(N)
  836.         @ VU = 1
  837.     }
  838.     if (match(ENEM* $0))
  839.     {
  840.         ^pp.set.changetoggle E $1
  841.         echo *** Checking/use of enemies list is now $pp.set.tstatus(E)
  842.         @ VU = 1
  843.     }
  844.     if (match(FRI* $0))
  845.     {
  846.         ^pp.set.changetoggle L $1
  847.         echo *** Checking/use of friends list is now $pp.set.tstatus(L)
  848.         @ VU = 1
  849.     }
  850.     if (match(AWAYN* $0))
  851.     {
  852.         ^pp.set.changetoggle O $1
  853.         echo *** Public announcement of away status is now $pp.set.tstatus(O)
  854.         @ VU = 1
  855.     }
  856.     if (match(AWAYL* $0))
  857.     {
  858.         ^pp.set.changetoggle G $1
  859.         echo *** Logging of messages and important events while away is now $pp.set.tstatus(G)
  860.         @ VU = 1
  861.     }
  862.     if (match(NOTI* $0))
  863.     {
  864.         ^pp.set.changetoggle W $1
  865.         echo *** Sending of general warnings/notices is now $pp.set.tstatus(W)
  866.         @ VU = 1
  867.     }
  868.     if (match(KREJ* $0))
  869.     {
  870.         ^pp.set.changetoggle J $1
  871.         echo *** Automatic rejoining on kick is now $pp.set.tstatus(J)
  872.         @ VU = 1
  873.     }
  874.     if (match(MASSP* $0))
  875.     {
  876.         ^pp.set.changetoggle M $1
  877.         echo *** Mass deop/kick protection is now $pp.set.tstatus(M)
  878.         @ VU = 1
  879.     }
  880.     if (match(MASSA* $0))
  881.     {
  882.         if (match($1 KICK DEOP))
  883.         {
  884.             if ([$1] == [KICK]) {@ PP.SET.MASSRESP = 1} {@ PP.SET.MASSRESP = 0}
  885.         }
  886.         if (PP.SET.MASSRESP) {/echo *** Action taken on mass deop/kick is now KICK}
  887.         {/echo *** Action taken on mass deop/kick is now DEOP}
  888.         @ VU = 1
  889.     }
  890.     if (match(KEYP* $0))
  891.     {
  892.         ^pp.set.changetoggle K $1
  893.         echo *** Channel key flash protection is now $pp.set.tstatus(K)
  894.         @ VU = 1
  895.     }
  896.     if (([$0] == [SERVOP])||([$0] == [NHP]))
  897.     {
  898.         ^pp.set.changetoggle S $1
  899.         echo *** Automatic removal of server ops is now $pp.set.tstatus(S)
  900.         @ VU = 1
  901.     }
  902.     if (match(CLONEP* $0))
  903.     {
  904.         ^pp.set.changetoggle C $1
  905.         echo *** Clonebot mass-join protection is now $pp.set.tstatus(C)
  906.         @ VU = 1
  907.     }
  908.     if (match(BAND* $0))
  909.     {
  910.         ^pp.set.changetoggle B $1
  911.         echo *** Ban defense is now $pp.set.tstatus(B)
  912.         @ VU = 1
  913.     }
  914.     if ([$0] == [PING])
  915.     {
  916.         ^pp.set.changetoggle X $1
  917.         echo *** Ignoring of CTCP PINGs is now $pp.set.tstatus(X)
  918.         @ VU = 1
  919.         ^pp.set.setupctcp
  920.     }
  921.     if (match(FING* $0))
  922.     {
  923.         ^pp.set.changetoggle Z $1
  924.         echo *** Ignoring of CTCP FINGERs is now $pp.set.tstatus(Z)
  925.         @ VU = 1
  926.         ^pp.set.setupctcp
  927.     }
  928.     if (match(VER* $0))
  929.     {
  930.         ^pp.set.changetoggle Y $1
  931.         echo *** Ignoring of CTCP VERSIONs is now $pp.set.tstatus(Y)
  932.         @ VU = 1
  933.         ^pp.set.setupctcp
  934.     }
  935. # Snak adaptation 1.3 Snak has integrated highlighting
  936. #    if ([$0] == [PMATCH])
  937. #    {
  938. #        if ([$1])
  939. #        {
  940. #            if ((PP.SET.PMATCH == [.])&&([$1] != [.])) {^pp.snm $strip(_-[] $N) $1}
  941. #            if ((PP.SET.PMATCH != [.])&&([$1] == [.])) {^pp.snm $PP.SET.PMATCH $strip(_-[] $N)}
  942. #            @ PP.SET.PMATCH = [$1]
  943. #        }
  944. #        echo *** String to match and highlight in public now set to ${PP.SET.PMATCH}
  945. #        @ VU = 1
  946. #    }
  947.     if (match(IGT* $0))
  948.     {
  949.         if ([$1]) {
  950.             if (!isalpha($1)) {@ PP.SET.IGSECS = [$1]}
  951.             {/echo *** Must be a number (recommended value: 10-60)}
  952.         }
  953.         echo *** Number of seconds to auto-ignore flooders is now: ${PP.SET.IGSECS}
  954.         @ VU = 1
  955.     }
  956.     if (match(NFS* $0))
  957.     {
  958.         if ([$1]) {
  959.             if (!isalpha($1)) {@ PP.SET.NFSENS = [$1]}
  960.             {/echo *** Must be a number (recommended value: 3)}
  961.         }
  962.         echo *** Nick flood protection sensitivity is now: ${PP.SET.NFSENS}
  963.         if (PP.SET.NFSENS > 3) {/echo *** Warning: a setting of ${PP.SET.NFSENS} is very sensitive! (higher values more sensitive)}
  964.         @ VU = 1
  965.     }
  966.     if ([$0] == [ROWS])
  967.     {
  968.         if ([$1]) {
  969.             if (!isalpha($1)) {@ PP.SET.NUMLINES = [$1] - 2}
  970.             {/echo *** Must be a number}
  971.         }
  972.         echo *** Number of rows on this display is now: ${PP.SET.NUMLINES + 2}
  973.         @ VU = 1
  974.     }
  975.     if (match(CLONES* $0))
  976.     {
  977.         if ([$1]) {
  978.             if (!isalpha($1)) {@ PP.SET.CPSENS = [$1]}
  979.             {/echo *** Must be a number (recommended value: 3-5)}
  980.         }
  981.         echo *** Clonebot mass-join protection sensitivity is now: ${PP.SET.CPSENS}
  982.         if (PP.SET.CPSENS < 3) {/echo *** Warning: a setting of ${PP.SET.CPSENS} is very sensitive! (lower values more sensitive)}
  983.         @ VU = 1
  984.     }
  985.     if ([$0] == [JFLEN])
  986.     {
  987.         if ([$1]) {
  988.             if (!isalpha($1)) {@ PP.SET.JFLEN = [$1]}
  989.             {/echo *** Must be a number (recommended value: 200)}
  990.         }
  991.         echo *** First word length for a message to be a junkflood is now: ${PP.SET.JFLEN}
  992.         @ VU = 1
  993.     }
  994.     if (match(AUTOA* $0))
  995.     {
  996.         if ([$1]) {
  997.             if (!isalpha($1)) {@ PP.SET.AUTOAWAY = [$1]}
  998.             {
  999.                 if ([$1] == [OFF]) {@ PP.SET.AUTOAWAY = 0} {/echo *** Must be a number or 'off' to turn off.}
  1000.             }
  1001.         }
  1002.         echo *** Minutes of idle-time before being set away (0=auto-away disabled): ${PP.SET.AUTOAWAY}
  1003.         @ VU = 1
  1004.     }
  1005.     if (match(*CMD $0))
  1006.     {
  1007.         foreach PP.SET AA {
  1008.             if ([$AA] == [$0])
  1009.             {
  1010.                 if ([$1]) {@ PP.SET[$AA] = [$1-]}
  1011.                 echo *** $AA is now [${PP.SET[$AA]}]
  1012.                 @ VU = 1
  1013.             }
  1014.         }
  1015.     }
  1016.     if (match(MSGB* $0))
  1017.     {
  1018.         if (match($1 ON OFF))
  1019.         {
  1020.             ^pp.set.changetoggle Q $1
  1021.             if ([$1] == [ON]) {^set beep_on_msg MSG}
  1022.             {^set beep_on_msg NONE}
  1023.         }
  1024.         echo *** Beeping on private messages is now $pp.set.tstatus(Q)
  1025.         @ VU = 1
  1026.     }
  1027.     if (match(LOGF* $0))
  1028.     {
  1029.         if ([$1]) {^set logfile $1}
  1030.         echo *** IRC logging is now sent to file ${LOGFILE}
  1031.         @ VU = 1
  1032.     }
  1033.     if ([$0] == [LOG])
  1034.     {
  1035.         if (match($1 ON OFF)) {^if ([$1] == [ON]) {^set log on} {^set log off}}
  1036.         echo *** Logging to $LOGFILE is now ${LOG}
  1037.         @ VU = 1
  1038.     }
  1039.     if (match(AWAYW* $0))
  1040.     {
  1041.         ^pp.set.changetoggle H $1
  1042.         echo *** Away log writing to $PP.SET.ALFILE is now $pp.set.tstatus(H)
  1043.         @ VU = 1
  1044.     }
  1045.     if ([$0] == [AFILE])
  1046.     {
  1047.         if ([$1]) {@ PP.SET.ALFILE = [$1]}
  1048.         echo *** Away log file is now ${PP.SET.ALFILE}
  1049.         @ VU = 1
  1050.     }
  1051. }
  1052.  
  1053. alias pp {
  1054.     if ([$0])
  1055.     {
  1056.         @ VU = 0
  1057.         foreach PP.SETCHECKS AA {^if (!VU) {$PP.SETCHECKS[$AA] $*}}
  1058.         if (!VU) {/echo *** No such variable: $0}
  1059.         ^assign -VU
  1060.     } {/echo *** /pp <variable> [<new setting>] (If new setting is left out, current setting is shown)}
  1061. }
  1062.  
  1063. # ----------------------------------------------------------------------------
  1064. # Command abbreviations
  1065. # ----------------------------------------------------------------------------
  1066.  
  1067. alias w {/who $*}
  1068. alias m {/msg $*}
  1069. alias t {/topic $*}
  1070. alias c {/mode $*}
  1071. alias l {
  1072.     leave $0
  1073.     if ([$1]) {/l $1-}
  1074. }
  1075. alias j {
  1076.     if (ischannel($1)) {/join $0} {/join $0 $1}
  1077.     if (ischannel($1)) {/j $1-}
  1078.     if (ischannel($2)) {/j $2-}
  1079. }
  1080. alias , {/whois $*}
  1081. alias wi {/whois $*}
  1082. alias ww {/whowas $*}
  1083. alias n {/nick $*}
  1084. alias k {/kick $*}
  1085. alias o {/op $*}
  1086. alias d {/deop $*}
  1087.  
  1088. alias scan {/names $*}
  1089.  
  1090. # ----------------------------------------------------------------------------
  1091. # Basic channel op command aliases
  1092. # ----------------------------------------------------------------------------
  1093.  
  1094. # Here's all the recursive list processing aliases for the mass commands
  1095. # pp.listm.<# at once> <mode> <#channel> <users>
  1096. alias pp.listm.1 {
  1097.     //mode $1 $0 $2
  1098.     if ([$3]) {^pp.listm.1 $0 $1 $3-}
  1099. }
  1100. alias pp.listm.2 {
  1101.     //mode $1 $0 $2 $3
  1102.     if ([$4]) {^pp.listm.2 $0 $1 $4-}
  1103. }
  1104. alias pp.listm.3 {
  1105.     //mode $1 $0 $2 $3 $4
  1106.     if ([$5]) {^pp.listm.3 $0 $1 $5-}
  1107. }
  1108. alias pp.listm.4 {
  1109.     //mode $1 $0 $2 $3 $4 $5
  1110.     if ([$6]) {^pp.listm.4 $0 $1 $6-}
  1111. }
  1112. # pp.listk <#channel> <nicks> ($KREASON contains reason for kicks)
  1113. alias pp.listk {
  1114.     //kick $0 $1 $KREASON
  1115.     if ([$2]) {^pp.listk $0 $2-}
  1116. }
  1117. # pp.listdcc <file> <nicks>
  1118. alias pp.listdcc {
  1119.     //^dcc send $1 $0
  1120.     if ([$2]) {^pp.listdcc $0 $2-}
  1121. }
  1122. # pp.listmsg <PRIVMSG/NOTICE> <nicks/channels> (SEND_MSG contains message)
  1123. alias pp.listmsg {
  1124.     ^quote $0 $1 :$SEND_MSG
  1125.     if ([$2]) {^pp.listmsg $0 $2-}
  1126. }
  1127. # pp.listunban <#channel> <strings>
  1128. alias pp.listunban {
  1129.     if ([$4])
  1130.     {
  1131.         //mode $0 -bbb $1 $2 $3
  1132.         ^pp.listunban $0 $4-
  1133.     } {^if ([$3]) {//mode $0 -bbb $1 $2 $3} {^if ([$2]) {//mode $0 -bb $1 $2} {^if ([$1]) {//mode $0 -b $1}}}}
  1134. }
  1135.  
  1136. # pp.mdop <#channel> <# at once> <mask>
  1137. # Smart massdeopper: deops the closest people net-wise first.  (Gee, I wonder
  1138. # how many scripts this is gonna appear in?)
  1139. alias pp.mdop {
  1140.     @ HIGHHOPS = 0
  1141.     @ DMASK = [$2]
  1142.     on ^who * {
  1143.         if ((match(*${DMASK}* $1!$3@$4))&&([$1] != N))
  1144.         {
  1145.             if (!match($1 $PP.BOTNICKS))
  1146.             {
  1147.                 if (!PP.EPIC)
  1148.                 {
  1149.                     @ MDOPZ[$5] = MDOPZ[$5]##[ $1]
  1150.                     if ([$5] > HIGHHOPS) {@ HIGHHOPS = [$5]}
  1151.                 }
  1152.                 {
  1153.                     @ MDOPZ[$6] = MDOPZ[$6]##[ $1]
  1154.                     if ([$6] > HIGHHOPS) {@ HIGHHOPS = [$6]}
  1155.                 }
  1156.             }
  1157.         }
  1158.     }
  1159.     //^who -chops $0
  1160.     @ DEOPCNT = [$1]
  1161.     @ DEOPCHAN = [$0]
  1162.     wait -CMD if (1) {
  1163.         if (DEOPCNT <= 1) {@ MCH = [-o]}
  1164.         if (DEOPCNT == 2) {@ MCH = [-oo]}
  1165.         if (DEOPCNT == 3) {@ MCH = [-ooo]}
  1166.         if (DEOPCNT >= 4) {@ MCH = [-oooo]}
  1167.         @ CTR = 0
  1168.         while (CTR <= HIGHHOPS)
  1169.         {
  1170.             @ MDOPZ = MDOPZ##[ $MDOPZ[$CTR]]
  1171.             ^assign -MDOPZ[$CTR]
  1172.             @ CTR = CTR + 1
  1173.         }
  1174.         ^pp.listm.$DEOPCNT $MCH $DEOPCHAN $MDOPZ
  1175.         ^assign -DEOPCNT
  1176.         ^assign -DEOPCHAN
  1177.         ^assign -MCH
  1178.         ^assign -HIGHHOPS
  1179.         ^assign -CTR
  1180.         ^assign -MDOPZ
  1181.         ^assign -DMASK
  1182.         ^on who -
  1183.     }
  1184. }
  1185.  
  1186. # pp.mkick <#channel> <mask> <reason>
  1187. alias pp.mkick {
  1188.     @ KMASK = [$1]
  1189.     ^on ^who * {
  1190.         ^if ((match(*${KMASK}* $1!$3@$4))&&([$1] != N))
  1191.         {
  1192.             ^if (!match($1 $PP.BOTNICKS)) {@ MKZ = [$1 $MKZ]}
  1193.         }
  1194.     }
  1195.     //^who $0
  1196.     @ KCHAN = [$0]
  1197.     @ KREASON = [$2-]
  1198.     wait -CMD if (1) {
  1199.         ^pp.listk $KCHAN $MKZ
  1200.         ^assign -KCHAN
  1201.         ^assign -MKZ
  1202.         ^assign -KMASK
  1203.         ^assign -KREASON
  1204.         ^on who -
  1205.     }
  1206. }
  1207.  
  1208. # pp.mop <#channel> <mask>
  1209. alias pp.mop {
  1210.     @ OPMASK = [$1]
  1211.     ^on ^who * {^if ((!match(*@* $2))&&(match(*${OPMASK}* $1!$3@$4))) {^if ([$1] != N) {@ MOPZ = [$MOPZ $1]}}}
  1212.     //^who $0
  1213.     @ MOPCHAN = [$0]
  1214.     wait -CMD if (1) {
  1215.         ^pp.listm.3 +ooo $MOPCHAN $MOPZ
  1216.         ^assign -MOPCHAN
  1217.         ^assign -MOPZ
  1218.         ^assign -OPMASK
  1219.         ^on ^who -
  1220.     }
  1221. }
  1222.  
  1223. # pp.modev <#channel> <mask> <+/->
  1224. alias pp.modev {
  1225.     @ VMASK = [$1]
  1226.     ^on ^who * {^if (match(*${VMASK}* $1!$3@$4)) {@ MVZ = [$MVZ $1]}}
  1227.     //^who $0
  1228.     @ MVCHAN = [$0]
  1229.     @ MVMODE = [$2]
  1230.     wait -CMD if (1) {
  1231.         ^pp.listm.3 ${MVMODE}vvv $MVCHAN $MVZ
  1232.         ^assign -MVCHAN
  1233.         ^assign -MVMODE
  1234.         ^assign -MVZ
  1235.         ^assign -VMASK
  1236.         ^on ^who -
  1237.     }
  1238. }
  1239.  
  1240. # The user mass commands
  1241. # mdop/mvop/mop/munvop [<mask>]
  1242. alias mdop.1 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 1 $0} {^pp.mdop $C 1 *}} {/echo *** You don't have ops on $C}}
  1243. alias mdop.2 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 2 $0} {^pp.mdop $C 2 *}} {/echo *** You don't have ops on $C}}
  1244. alias mdop.3 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 3 $0} {^pp.mdop $C 3 *}} {/echo *** You don't have ops on $C}}
  1245. alias mdop.4 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 4 $0} {^pp.mdop $C 4 *}} {/echo *** You don't have ops on $C}}
  1246. alias mdop {^mdop.4 $*}
  1247. alias mop {^if (gotops($C)) {^if ([$0]) {^pp.mop $C $0} {^pp.mop $C *}} {/echo *** You don't have ops on $C}}
  1248. alias mvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 +} {^pp.modev $C * +}} {/echo *** You don't have ops on $C}}
  1249. alias munvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 -} {^pp.modev $C * -}} {/echo *** You don't have ops on $C}}
  1250.  
  1251. # Fast mdop (x4)
  1252. alias fmdop {
  1253.     if (gotops($C))
  1254.     {
  1255.         if (match(*!*@* $0)) {@ UM = [$0]} {@ UM = [*!*@*]}
  1256.         foreach PP.USERS.$encode($tolower($C)) AA {
  1257.             if (decode($AA) != N)
  1258.             {
  1259.                 if ((ischanop($decode($AA) $C))&&(match($UM $decode($AA)!$word(2 $PP.USERS[$encode($tolower($C))][$AA])))) {@ MDOPZ = MDOPZ##[$decode($AA) ]}
  1260.             }
  1261.         }
  1262.         pp.listm.4 -oooo $C $MDOPZ
  1263.         ^assign -MDOPZ
  1264.         ^assign -UM
  1265.     } {/echo *** You don't have ops on $C}
  1266. }
  1267.  
  1268. # op and deop aliases
  1269. # op/deop <nicks>
  1270. alias op {^if ([$0]) {^pp.listm.3 +ooo $C $*} {/echo *** /op <nick> [<nick> ...]}}
  1271. alias deop {^if ([$0]) {^pp.listm.2 -oo $C $*} {/echo *** /deop <nick> [<nick> ...]}}
  1272.  
  1273. # masskick aliases
  1274. # masskick [<reason>] (kicks with mask *)  mkick [<mask>]
  1275. alias masskick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C * $*} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  1276. alias mkick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C $0 [Masskick: $0]} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  1277.  
  1278. # Kicks all non-operators on channel
  1279. alias lkick {
  1280.     if (gotops($C))
  1281.     {
  1282.         ^on ^who * {/if (([$1] != N)&&(!rmatch($2 *@*))) {//kick $0 $1 [Non-Operator Kick]}}
  1283.         //^who *
  1284.         wait -CMD ^on who -
  1285.     } {/echo *** You don't have ops on $C}
  1286. }
  1287.  
  1288. # massdcc <file> [<mask>]
  1289. alias massdcc {
  1290.     if ([$0])
  1291.     {
  1292.         if ([$1]) {@ DCCMASK = [$1]} {@ DCCMASK = [*]}
  1293.         ^on ^who * {^if (([$1] != N)&&(match(*${DCCMASK}* $1!$3@$4))) {@ DCCPPL = [$1 $DCCPPL]}}
  1294.         //^who *
  1295.         @ MDFILE = [$0]
  1296.         wait -CMD if (1) {
  1297.             ^on who -
  1298.             ^pp.listdcc $MDFILE $DCCPPL
  1299.             ^assign -DCCMASK
  1300.             ^assign -DCCPPL
  1301.             echo *** Sent DCC SEND request for $MDFILE to everyone in $C
  1302.             ^assign -MDFILE
  1303.         }
  1304.     } {/echo *** /massdcc <file> [<mask>]}
  1305. }
  1306.  
  1307. # Re-aliased to not require channel names
  1308. alias invite {^if (ischannel($1)) {//invite $*} {//invite $0 $C}}
  1309. alias kick {^if (ischannel($0)) {//kick $*} {//kick $C $0 $1-}}
  1310. alias mode {^if (ischannel($0)) {//mode $*} {^if ([$0] == N) {//mode $*} {//mode $C $*}}}
  1311.  
  1312. # pp.snm old new
  1313. # Snak adaptation 1.3 Snak has integrated highlighting
  1314. #alias pp.snm {
  1315. #    EVAL ^on raw_irc - "% PRIVMSG #% :*$0*"
  1316. #    EVAL ^on ^raw_irc "% PRIVMSG #% :*$1*" {
  1317. #        if (match(*ACTION* $3))
  1318. #        {
  1319. #            if ([$2] == C) {/xecho -window $winnum() -level PUBLIC * $nickonly($0) $strip( $4-)}
  1320. #            {/xecho -window $winnum() -level PUBLIC * $nickonly($0):$2 $strip( $4-)}
  1321. #        }
  1322. #        {
  1323. #            if ([$2] == C) {/xecho -window $winnum() -level PUBLIC <$nickonly($0)> $strip( $mid(1 65535 $3) $4-)}
  1324. #            {/xecho -window $winnum() -level PUBLIC <$nickonly($0):$2> $strip( $mid(1 65535 $3) $4-)}
  1325. #        }
  1326. #    }
  1327. #}
  1328.  
  1329. # Snak adaptation 1.3 Snak has integrated highlighting
  1330. alias nick {
  1331.     ^if ([$0])
  1332.     {
  1333. #        if (PP.SET.PMATCH == [.]) {^pp.snm $strip(_-[] $N) $strip(_-[] $0)}
  1334.         if (PP.DCC) {^dcc.onnick $*}
  1335.         quote NICK $*
  1336.     } {/nick $randcrap(9)}
  1337. }
  1338.  
  1339. # We don't use the -k$M method because of how the mode locking code works
  1340. alias clearmode {
  1341.     if (ischannel($0))
  1342.     {
  1343.         ^on ^324 * {@ CMODE = strip(:+ $2)##[ $3-]}
  1344.         //mode $0
  1345.         @ CMCHAN = [$0]
  1346.         wait -CMD if (1) {
  1347.             ^on 324 -
  1348.             //mode $CMCHAN -k$CMODE
  1349.             ^assign -CMCHAN
  1350.             ^assign -CMODE
  1351.         }
  1352.     } {/clearmode $C}
  1353. }
  1354.  
  1355. # Bans bots and bomb/inverse/beep/etc usernames
  1356. alias botban {//mode $C +bbb *b?t!*@* *srv!*@* *s?rv!*@*}
  1357. alias bot {//bot}
  1358.  
  1359. # pp.clearban <channel> <mask>
  1360. alias pp.clearban {
  1361.     @ BANMASK = [$1]
  1362.     ^on ^raw_irc "% 367 *" {^if ((match(*${BANMASK}* $4))||(match($4 $BANMASK))) {@ CBUNBAND = [$4 $CBUNBAND]}}
  1363.     //mode $0 b
  1364.     wait -CMD if (1) {
  1365.         ^pp.listunban $C $CBUNBAND
  1366.         ^assign -CBUNBAND
  1367.         ^assign -BANMASK
  1368.         ^on raw_irc - "% 367 *"
  1369.     }
  1370. }
  1371.  
  1372. # User clearban alias
  1373. # clearban [<mask>]
  1374. alias clearban {^if ([$0]) {^pp.clearban $C $*} {^pp.clearban $C *}}
  1375.  
  1376. # Unban alias: looks up user's user@host and runs a clearban
  1377. # unban <nick>
  1378. alias unban {
  1379.     if ([$0]) {
  1380.         if (match(*!*@* $0)) {^pp.listunban $C $*}
  1381.         {
  1382.             ^Userhost $0 -CMD if ([$3]) {
  1383.                 if ([$4] != [<UNKNOWN>]) {^pp.clearban $C $0!$3@$4} {/echo *** $0 is not on IRC}
  1384.             }
  1385.         }
  1386.     } {/echo *** /unban <nick/umask>}
  1387. }
  1388.         
  1389. # ban <nick>
  1390. alias ban {
  1391.     if ([$0])
  1392.     {
  1393.         if (match(*!*@* $0)) {//mode $C +bbb $*}
  1394.         {
  1395.             ^Userhost $0 -CMD if ([$3]) {
  1396.                 if ([$4] != [<UNKNOWN>])
  1397.                 {
  1398.                     @ HNAME = [$4]
  1399.                     if ((!isalpha($HNAME))&&(match(*.*.*.* $HNAME))) {@ ST = [*!*$mid(1 1000 $3)@]##left($rindex(. $HNAME) $HNAME)##[.*]}
  1400.                     {@ ST = [*!*$mid(1 1000 $3)@*$right(${@HNAME-index(. $4)} $4)]}
  1401.                     if (PP.SET.FUNKYBANS)
  1402.                     {
  1403.                         @ AA = []
  1404.                         @ CT = 0
  1405.                         while (CT < [$@ST])
  1406.                         {
  1407.                             @ SC = mid($CT 1 $ST)
  1408.                             if ((!match(*${SC}* @!.))&&(SC != [*]))
  1409.                             {
  1410.                                 if (rand(4) == 2) {@ AA = AA##[?]}
  1411.                                 {@ AA = AA##SC}
  1412.                             } {@ AA = AA##SC}
  1413.                             @ CT = CT + 1
  1414.                         }
  1415.                         ^assign -CT
  1416.                         ^assign -SC
  1417.                     } {@ AA = ST}
  1418.                     ^assign -ST
  1419.                     ^assign -HNAME
  1420.                     //mode $C +b $AA
  1421.                 } {/echo *** $0 is not on IRC}
  1422.             }
  1423.         }
  1424.     } {//mode $C b}
  1425. }
  1426.  
  1427. # /wordkick <channel> <word/phrase>
  1428. # or /wordkick <channel> off
  1429. alias wordkick {
  1430.     if ([$1])
  1431.     {
  1432.         if (ischannel($0)) {@ WCHAN = [$0]} {@ WCHAN = [#$0]}
  1433.         if ([$1] == [OFF])
  1434.         {
  1435.             foreach WORDKICKS AA {
  1436.                 if (decode($AA) == [$WCHAN])
  1437.                 {
  1438.                     EVAL ^on raw_irc - "% ??????% $decode($AA) :*$WORDKICKS[$AA]*"
  1439.                     ^assign -WORDKICKS[$AA]
  1440.                     @ WK = 1
  1441.                 }
  1442.             }
  1443.             if (WK) {/echo *** Wordkick for $WCHAN removed} {/echo *** There is no wordkick active on $WCHAN}
  1444.             ^assign -WK
  1445.         }
  1446.         {
  1447.             @ WORDKICKS[$encode($WCHAN)] = [$1-]
  1448.             EVAL ^on -raw_irc "% ??????% $WCHAN :*$1-*" {
  1449.                 //kick $2 $nickonly($0) [Wordkick]
  1450.             }
  1451.             echo *** Wordkick for '$1-' now active on channel $WCHAN
  1452.         }
  1453.         ^assign -WCHAN
  1454.     }
  1455.     {
  1456.         echo *** Active wordkicks:
  1457.         foreach WORDKICKS AA {/echo *** Channel: $[12]decode($AA) Word/phrase: $WORDKICKS[$AA]}
  1458.     }
  1459. }
  1460.  
  1461. # ----------------------------------------------------------------------------
  1462. # Friends and enemies lists handlers
  1463. # ----------------------------------------------------------------------------
  1464.  
  1465. # 'CK' is $encode(*)
  1466.  
  1467. # pp.addl <FRIENDS/ENEMIES> <umask> <channel/*>
  1468. alias pp.addl {
  1469.     if ((!match($1 $PP[$0][$encode($toupper($2))]))&&(!match($1 $PP[$0][CK])))
  1470.     {
  1471.         if (PP[$0][$encode($toupper($2))]) {@ PP[$0][$encode($toupper($2))] = PP[$0][$encode($toupper($2))]##[ $1]} {@ PP[$0][$encode($toupper($2))] = [$1]}
  1472.         if ([$2] == [*]) {/echo *** User mask [$1] added to global $tolower($0) list}
  1473.         {/echo *** User mask [$1] added to $tolower($0) list for channel mask $2}
  1474.     }
  1475.     {
  1476.         if ([$2] == [*]) {/echo *** A user mask matching [$1] is already on your global friends list}
  1477.         {/echo *** A user mask matching [$1] is already on the list for channel mask $2 or the global list}
  1478.     }
  1479. }
  1480. # pp.rml <FRIENDS/ENEMIES> <umask> <channel/*>
  1481. alias pp.rml {
  1482.     if ((match($1 $PP[$0][$encode($toupper($2))]))||(rmatch($1 $PP[$0][$encode($toupper($2))])))
  1483.     {
  1484.         @ CN = encode($toupper($2))
  1485.         @ AA = 0
  1486.         while (word($AA $PP[$0][$CN]))
  1487.         {
  1488.             if ((match($1 $word($AA $PP[$0][$CN])))||(match($word($AA $PP[$0][$CN]) $1)))
  1489.             {
  1490.                 ^delword $word($AA $PP[$0][$CN]) $PP[$0][$CN]
  1491.                 @ PP[$0][$CN] = NLIST
  1492.                 ^assign -NLIST
  1493.                 @ AA = 0
  1494.             } {@ AA = AA + 1}
  1495.         }
  1496.         if (!(word(0 $PP[$0][$CN]))) {^assign -PP[$0][$CN]}
  1497.         ^assign -CN
  1498.         if ([$2] == [*]) {/echo *** All patterns matching [$1] removed from global $tolower($0) list}
  1499.         {/echo *** All patterns matching [$1] removed from list for channel mask $2}
  1500.     }
  1501.     {
  1502.         if ([$2] == [*]) {/echo *** No patterns matching [$1] are on your global friends list}
  1503.         {/echo *** No patterns matching [$1] are on the list for channel mask $2 or the global list}
  1504.     }
  1505. }
  1506. # pp.rmlall <FRIENDS/ENEMIES> <umask>
  1507. alias pp.rmlall {
  1508.     EVAL ^foreach PP.$0 AB {
  1509.         if ((match($1 $PP[$0][$AB]))||(rmatch($1 $PP[$0][$AB]))) {^pp.rml $0 $1 $tolower($decode($AB))}
  1510.     }
  1511. }
  1512.  
  1513. # /friend <nick/umask> [<channel mask>]
  1514. alias friend {
  1515.     if ([$0])
  1516.     {
  1517.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl FRIENDS $0 $1} {/pp.addl FRIENDS $0 *}}
  1518.         {
  1519.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1520.             ^Userhost $0 -CMD if ([$3]) {
  1521.                 if ([$4] != [<UNKNOWN>])
  1522.                 {
  1523.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1524.                     ^pp.addl FRIENDS *!*$UHOST $AA
  1525.                     ^alias echo {}
  1526.                     ^pp.rml ENEMIES *!*$UHOST $AA
  1527.                     ^alias -echo
  1528.                     ^assign -UHOST
  1529.                     if (index(W $PP.SET) >= 0) {//^notice $0 [PurePak] You have been added to my friends list for channels matching [${AA}]: type /ctcp $N HELP for functions available to you}
  1530.                 } {/echo *** $0 is not on IRC}
  1531.             }
  1532.         }
  1533.     } {/echo *** /friend <nick/umask> [<channel mask>] (can contain wildcards)}
  1534. }
  1535. # /enemy <nick/umask> [<channel mask>]
  1536. alias enemy {
  1537.     if ([$0])
  1538.     {
  1539.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl ENEMIES $0 $1} {/pp.addl ENEMIES $0 *}}
  1540.         {
  1541.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1542.             ^Userhost $0 -CMD if ([$3]) {
  1543.                 if ([$4] != [<UNKNOWN>])
  1544.                 {
  1545.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1546.                     ^pp.addl ENEMIES *!*$UHOST $AA
  1547.                     ^alias echo {}
  1548.                     ^pp.rml FRIENDS *!*$UHOST $AA
  1549.                     ^alias -echo
  1550.                     ^assign -UHOST
  1551.                 } {/echo *** $0 is not on IRC}
  1552.             }
  1553.         }
  1554.     } {/echo *** /enemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1555. }
  1556.  
  1557. # /rmfriend <nick/umask> [<channel mask>]
  1558. alias rmfriend {
  1559.     if ([$0])
  1560.     {
  1561.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml FRIENDS $0 $1} {/pp.rmlall FRIENDS $0}}
  1562.         {
  1563.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1564.             ^Userhost $0 -CMD if ([$3]) {
  1565.                 if ([$4] != [<UNKNOWN>])
  1566.                 {
  1567.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1568.                     if (AA == [AA]) {^pp.rmlall FRIENDS *!*$UHOST} {^pp.rml FRIENDS *!*$UHOST $AA}
  1569.                     ^assign -UHOST
  1570.                 } {/echo *** $0 is not on IRC}
  1571.             }
  1572.         }
  1573.     } {/echo *** /rmfriend <nick/umask> [<channel mask>] (can contain wildcards)}
  1574. }
  1575. # /rmenemy <nick/umask> [<channel mask>]
  1576. alias rmenemy {
  1577.     if ([$0])
  1578.     {
  1579.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml ENEMIES $0 $1} {/pp.rmlall ENEMIES $0}}
  1580.         {
  1581.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1582.             ^Userhost $0 -CMD if ([$3]) {
  1583.                 if ([$4] != [<UNKNOWN>])
  1584.                 {
  1585.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1586.                     if (AA == [AA]) {^pp.rmlall ENEMIES *!*$UHOST} {^pp.rml ENEMIES *!*$UHOST $AA}
  1587.                     ^assign -UHOST
  1588.                 } {/echo *** $0 is not on IRC}
  1589.             }
  1590.         }
  1591.     } {/echo *** /rmenemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1592. }
  1593.  
  1594. alias nofriends {/rmfriend *!*@*}
  1595. alias noenemies {/rmenemy *!*@*}
  1596.  
  1597. alias lsfriends {
  1598.     echo *** Channel Mask   Patterns
  1599.     if (PP.FRIENDS.CK) {/echo *** [Global (*)]   $PP.FRIENDS.CK}
  1600.     foreach PP.FRIENDS AA {
  1601.         if (AA != [CK])
  1602.         {
  1603.             @ CM = tolower($decode($AA))
  1604.             echo *** $[14]CM $PP.FRIENDS[$AA]
  1605.         }
  1606.     }
  1607.     ^assign -CM
  1608. }
  1609. alias lsenemies {
  1610.     echo *** Channel Mask   Patterns
  1611.     if (PP.ENEMIES.CK) {/echo *** [Global (*)]   $PP.ENEMIES.CK}
  1612.     foreach PP.ENEMIES AA {
  1613.         if (AA != [CK])
  1614.         {
  1615.             @ CM = tolower($decode($AA))
  1616.             echo *** $[14]CM $PP.ENEMIES[$AA]
  1617.         }
  1618.     }
  1619.     ^assign -CM
  1620. }
  1621.  
  1622. # ----------------------------------------------------------------------------
  1623. # Miscellaneous user aliases
  1624. # ----------------------------------------------------------------------------
  1625.  
  1626. # pp.mmsg <PRIVMSG/NOTICE> <who status match> <msg>
  1627. alias pp.mmsg {
  1628.     @ STATP = [$1]
  1629.     ^on ^who * {^if (([$1] != N)&&(match($STATP $2))) {@ MSGNICKS = [$1 ]##MSGNICKS}}
  1630.     @ SEND_TYPE = [$0]
  1631.     @ SEND_MSG = [$2-]
  1632.     //^who *
  1633.     wait -CMD if (1) {
  1634.         ^on who -
  1635.         ^pp.listmsg $SEND_TYPE $MSGNICKS
  1636.         if (SEND_TYPE == [NOTICE])
  1637.         {
  1638.             @ EC.1 = [-]
  1639.             @ EC.2 = [-]
  1640.         }
  1641.         {
  1642.             @ EC.1 = [[]
  1643.             @ EC.2 = []]
  1644.         }
  1645.         if (STATP == [*@*]) {/echo -> ${EC.1}OPS@$C${EC.2} $SEND_MSG} {/echo -> ${EC.1}*@$C${EC.2} $SEND_MSG}
  1646.         ^assign -EC.1
  1647.         ^assign -EC.2
  1648.         ^assign -SEND_TYPE
  1649.         ^assign -SEND_MSG
  1650.         ^assign -MSGNICKS
  1651.         ^assign -STATP
  1652.     }
  1653. }
  1654.  
  1655. # Mass msg'ing aliases
  1656. alias msgall {^if ([$0]) {^pp.mmsg PRIVMSG * $*} {/echo *** /msgall <msg>}}
  1657. alias msgops {^if ([$0]) {^pp.mmsg PRIVMSG *@* $*} {/echo *** /msgops <msg>}}
  1658. alias wallops {^if ([$0]) {^pp.mmsg NOTICE *@* [WallOps:${C}] $*} {/echo *** /wallops <msg> (Use //wallops to use IRC's original wallops command)}}
  1659. alias wall {/wallops $*}
  1660.  
  1661. # So that help servers won't trigger flood protection
  1662. alias help {
  1663.     EVAL ^on -flood "$help_service *" {}
  1664.     EVAL ^timer 60 ^on flood - "$help_service *"
  1665.     //help $*
  1666. }
  1667.  
  1668. alias finger {
  1669.     if ([$0])
  1670.     {
  1671.         if (match(*@* $0)) {/exec $PP.SET.FINGERCMD $0}            
  1672.         {
  1673.             ^Userhost $0 -CMD if ([$3]) {^if ([$3] != [<UNKNOWN>]) {/exec $PP.SET.FINGERCMD $strip(~ $3)@$4} {/echo *** $0 is not on IRC}}
  1674.         }
  1675.     } {/echo *** /finger <nick> -or- /finger <user@host>}
  1676. }
  1677.  
  1678. # Uncompressing /load command
  1679. on ^exec "uncomp *" {/echo *** Output from uncompress program: $1-}
  1680. alias load {
  1681.     if ([$0])
  1682.     {
  1683.         if (right(3 $0) == [.gz]) {@ COMPRESS.ISCOMP = PP.SET.UNGZCMD}
  1684.         if (right(2 $0) == [.Z]) {@ COMPRESS.ISCOMP = PP.SET.UNZCMD}
  1685.         if (COMPRESS.ISCOMP)
  1686.         {
  1687.             ^set input_prompt [$0] Uncompressing and loading...
  1688.             @ COMPRESS.PIPENAME = [/tmp/pptmp]##rand(99999999)
  1689.             @ CMPFILE = [$0]
  1690.             exec -name mknod $PP.SET.MKNODCMD $COMPRESS.PIPENAME p
  1691.             wait -CMD %mknod if (1) {
  1692.                 exec -name uncomp $COMPRESS.ISCOMP $CMPFILE >>$COMPRESS.PIPENAME
  1693.                 //load $COMPRESS.PIPENAME
  1694.                 exec -name rm $PP.SET.RMCMD $COMPRESS.PIPENAME
  1695.                 ^assign -CMPFILE
  1696.                 ^assign -COMPRESS.PIPENAME
  1697.                 ^assign -COMPRESS.ISCOMP
  1698.                 ^set -input_prompt
  1699.             }
  1700.         }
  1701.         {
  1702.             ^set input_prompt [$0] Loading...
  1703.             //load $*
  1704.             ^set -input_prompt
  1705.         }
  1706.     } {//load}
  1707. }
  1708.  
  1709. alias names {^if ([$0]) {//names $*} {/if (ischannel($C)) {//names $C}}}
  1710. alias chops {^if ([$0]) {/who $0 -chops} {/who $C -chops}}
  1711.  
  1712. alias bk {
  1713.     if ([$0])
  1714.     {
  1715.         ^ban $0
  1716.         @ KN = [$0]
  1717.         ^assign KR $1-
  1718.         wait -CMD if (1) {
  1719.             //^kick $C $KN $KR
  1720.             ^assign -KN
  1721.             ^assign -KR
  1722.         }
  1723.     } {/echo *** /bk <nick> [<reason>]}
  1724. }
  1725.  
  1726. alias leave {^if ([$0]) {^if (ischannel($0)) {//leave $*} {//leave #$*}} {//leave $C}}
  1727. alias part {/leave $*}
  1728. alias join {^if ((ischannel($0))||(match(-* $0))) {//join $*} {//join #$*}}
  1729.  
  1730. # Yet another command that is destined to show up in tons of other scripts :)
  1731. # /avoid <nick> or /avoid - <nick> ... just /avoid displays a list
  1732. alias avoid {
  1733.     if ([$0])
  1734.     {
  1735.         if ([$0] == [-])
  1736.         {
  1737.             if ([$1])
  1738.             {
  1739.                 if (match($1 $PP.SET.AVOID))
  1740.                 {
  1741.                     ^delword $1 $PP.SET.AVOID
  1742.                     @ PP.SET.AVOID = NLIST
  1743.                     ^assign -NLIST
  1744.                     echo *** Nick $1 removed from aviodance list
  1745.                 }
  1746.                 {
  1747.                     if ([$1] == [*])
  1748.                     {
  1749.                         ^assign -PP.SET.AVOID
  1750.                         echo *** Avoidance list cleared
  1751.                     } {/echo *** Nick $1 is not on your avoidance list}
  1752.                 }
  1753.             } {/echo *** /avoid - <nick>}
  1754.         }
  1755.         {
  1756.             if (match($1 $PP.SET.AVOID)) {/echo *** Nick $0 is already on your avoidance list}
  1757.             {
  1758.                 @ PP.SET.AVOID = PP.SET.AVOID##[$0 ]
  1759.                 echo *** Nick $0 added to avoidance list
  1760.                 if (!match($0 $PP.SET.NOTIFY)) {^notify $0}
  1761.             }
  1762.         }
  1763.     } {/echo *** Avoidance list: $PP.SET.AVOID}
  1764. }
  1765.  
  1766. alias cstats {
  1767.     @ CSOPS = 0
  1768.     @ CSNOPS = 0
  1769.     @ CSOPERS = 0
  1770.     @ CSHERE = 0
  1771.     @ CSGONE = 0
  1772.     @ CSUCOUNT = 0
  1773.     @ CSFARTHEST = 0
  1774.     ^on ^who * {
  1775.         if (match(*@* $2)) {@ CSOPS = CSOPS + 1} {@ CSNOPS = CSNOPS + 1}
  1776.         if ((mid(1 1 $2) == [*])||(mid(2 1 $2) == [*])) {@ CSOPERS = CSOPERS + 1}
  1777.         if (match(*H* $2)) {@ CSHERE = CSHERE + 1} {@ CSGONE = CSGONE + 1}
  1778.         @ CSUCOUNT = CSUCOUNT + 1
  1779.         if ([$5] > CSFARTHEST) {@ CSFARTHEST = [$5]}
  1780.     }
  1781.     if (ischannel($0)) {@ CSCHAN = [$0]} {@ CSCHAN = C}
  1782.     //^who $CSCHAN
  1783.     wait -CMD if (1) {
  1784.         ^on who -
  1785.         echo *** Stats for channel ${CSCHAN}:
  1786.         echo *** Total Users:${CSUCOUNT}   Ops:${CSOPS}   Non-ops:${CSNOPS}   IRCOps:${CSOPERS}
  1787.         echo *** Here:${CSHERE}   Away:${CSGONE}   Server hops to farthest user:${CSFARTHEST}
  1788.         ^assign -CSOPS
  1789.         ^assign -CSNOPS
  1790.         ^assign -CSCHAN
  1791.         ^assign -CSOPERS
  1792.         ^assign -CSHERE
  1793.         ^assign -CSGONE
  1794.         ^assign -CSUCOUNT
  1795.         ^assign -CSFARTHEST
  1796.     }
  1797. }
  1798.  
  1799. # We alias the notify list so we can keep track of it and save it with /sve
  1800. alias pp.notifychk {
  1801.     if ([$0] == [-]) {^assign -PP.SET.NOTIFY}
  1802.     {
  1803.         @ AA = 0
  1804.         while (word($AA $*))
  1805.         {
  1806.             if (match(-* $word($AA $*)))
  1807.             {
  1808.                 if (PP.SET.NOTIFY)
  1809.                 {
  1810.                     ^delword $mid(1 1000 $word($AA $*)) $PP.SET.NOTIFY
  1811.                     @ PP.SET.NOTIFY = NLIST
  1812.                     ^assign -NLIST
  1813.                 }
  1814.             }
  1815.             {
  1816.                 if (!match($word($AA $*) $PP.SET.NOTIFY)) {@ PP.SET.NOTIFY = PP.SET.NOTIFY##[$word($AA $*) ]}
  1817.             }
  1818.             @ AA = AA + 1
  1819.         }
  1820.     }
  1821. }
  1822. alias notify {
  1823.     //notify $*
  1824.     if ([$0]) {^pp.notifychk $*}
  1825. }
  1826.  
  1827. alias version {
  1828.     if ([$0]) {^if (match(*.* $0)) {//version $*} {//ctcp $0 VERSION}}
  1829.     {
  1830.         //version
  1831.         echo *** PurePak: version $PPVERS
  1832.     }
  1833. }
  1834.  
  1835. alias rwhois {^if ([$0]) {/whois $0 $0} {/whois $N}}
  1836. alias whois {
  1837.     @ WHOISINPROGRESS = 1
  1838.     //whois $*
  1839.     wait -CMD if (1) {^timer 2 ^assign -WHOISINPROGRESS}
  1840. }
  1841.  
  1842. # /nslookup <nick> or /nslookup <ip address>
  1843. alias nslookup {
  1844.     if ([$0])
  1845.     {
  1846.         if (match(*.* $0)) {^pp.dolookup $0}
  1847.         {
  1848.             ^Userhost $0 -CMD if ([$3]) {
  1849.                 if ([$4] != [<UNKNOWN>])
  1850.                 {
  1851.                     if (!isalpha($4)) {^pp.dolookup $4}
  1852.                     {/echo *** $0 is not online as an IP address}
  1853.                 } {/echo *** $0 is not on IRC}
  1854.             }
  1855.         }
  1856.     } {/echo *** /nslookup <nick> -or- /nslookup <ip address>}
  1857. }
  1858. alias pp.dolookup {
  1859.     if (!LOOKINGUP)
  1860.     {
  1861.         exec -name NSLOOKUP $PP.SET.NSLOOKCMD $0
  1862.         @ IPAD = [$0]
  1863.         @ LOOKINGUP = 1
  1864.     }
  1865. }
  1866. on ^exec "NSLOOKUP *" {}
  1867. on ^exec_error "NSLOOKUP *" {}
  1868. on ^exec "NSLOOKUP *Name*" {^pp.gn $*}
  1869. on ^exec_error "NSLOOKUP *Name*" {^pp.gn $*}
  1870. on ^exec_exit "NSLOOKUP *" {
  1871.     if (NSHOST) {/echo *** $IPAD is ${NSHOST}} {/echo *** Could not resolve a hostname for $IPAD}
  1872.     ^assign -NSHOST
  1873.     ^assign -IPAD
  1874.     ^assign -LOOKINGUP
  1875. }
  1876. alias pp.gn {
  1877.     @ AA = 0
  1878.     while (word($AA $*))
  1879.     {
  1880.         if (match(*.* $word($AA $*))) {@ NSHOST = word($AA $*)}
  1881.         @ AA = AA + 1
  1882.     }
  1883. }
  1884.  
  1885. alias ig {
  1886.     if ([$0])
  1887.     {
  1888.         ^Userhost $0 -CMD if ([$3]) {
  1889.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 MSG NOTICE CTCP PUBLIC} {/echo *** $0 is not on IRC}
  1890.         }
  1891.     } {/echo *** /ig <nick>}
  1892. }
  1893. alias unig {
  1894.     if ([$0])
  1895.     {
  1896.         ^Userhost $0 -CMD if ([$3]) {
  1897.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 NONE} {/echo *** $0 is not on IRC}
  1898.         }
  1899.     } {/echo *** /unig <nick>}
  1900. }
  1901. # Snak adaptation 1.2. Snaks ischanop is correct and these checks take time
  1902. # Snak adaptation 1.4. Don't reformat /who output - take out alias aw
  1903. alias who {
  1904.     if ((!DOINGWHO)&&(!SYNCING))
  1905.     {
  1906. #        ^on ^who * {
  1907. #            @ PP.USERS[$WINNUM()][$encode($tolower($0))][$encode($tolower($1))] = [$0 $1 $3@$4]
  1908. #            if (match(*@* $2))
  1909. #            {
  1910. #                if ((!ischanop($1 $0))&&(!PP.ICWARNED))
  1911. #                {
  1912. #                    echo *** Warning: your client's ischanop() function is inaccurate \($1 is op, ischanop() reports not op\)\; channel op status on /users lists may be wrong
  1913. #                    @ PP.ICWARNED = 1
  1914. #                }
  1915. #            }
  1916. #            {
  1917. #                if ((ischanop($1 $0))&&(!PP.ICWARNED))
  1918. #                {
  1919. #                    echo *** Warning: your client's ischanop() function is inaccurate \($1 is not op, ischanop() reports op\)\; channel op status on /users lists may be wrong
  1920. #                    @ PP.ICWARNED = 1~
  1921. #                }
  1922. #            }
  1923. #            aw $*
  1924. #        }
  1925. #        ^if (!PP.EPIC) {^alias aw {/xecho -level CRAP $[10]0 $[9]1 $[3]2 [$[2]5]  $3@$4 \($6-\)}}
  1926. #        {^alias aw {/xecho -level CRAP $[10]0 $[9]1 $[3]2 [$[2]6]  $3@$4 \($7-\)}}
  1927.         if ([$0]) {//who $*} {//who *}
  1928. #        @ DOINGWHO = 1
  1929. #        ^wait -CMD if (1) {
  1930. #            ^alias -aw
  1931. #            ^on who -
  1932. #            ^assign -DOINGWHO
  1933. #        }
  1934.     } {^if (SYNCING) {/echo *** /users synchronization in progress\; try again in a few seconds}}
  1935. }
  1936.  
  1937. alias serv {//server $*}
  1938. alias umode {//mode $N $*}
  1939.  
  1940. # Unflash command that should work on ALL clients
  1941. alias unflash {
  1942.     if (V <= 19930629)
  1943.     {
  1944.         ^set status_clock c
  1945.         ^type ^L
  1946.         ^set status_clock \;\24r
  1947.         ^type ^L
  1948.         ^set status_clock m
  1949.         ^type ^L
  1950.         ^set status_clock ?5l
  1951.         ^type ^L
  1952.         sleep 1
  1953.         ^set status_clock  %T
  1954.         ^type ^L
  1955.         echo *** Screen restored
  1956.     }
  1957.     {
  1958.         if ([$TTY])
  1959.         {
  1960.             if (match(*/* $TTY)) {^assign MYTTY $TTY} {^assign MYTTY /dev/$TTY}
  1961.             ^exec -name unflash echo c >>$MYTTY
  1962.             ^exec -name unflash echo \\\;\24r >>$MYTTY
  1963.             ^exec -name unflash echo m >>$MYTTY
  1964.             ^exec -name unflash echo ?5l >>$MYTTY
  1965.             ^exec -name unflash reset >>$MYTTY
  1966.             wait -CMD %unflash if (1) {
  1967.                 ^type ^L
  1968.                 ^assign -MYTTY
  1969.                 echo *** Screen restored
  1970.             }
  1971.         } {/echo *** UNFLASH FAILED: ENVIRONMENT VARIABLE 'TTY' MUST BE SET TO YOUR TTY.  SEE README.PPK}
  1972.     }
  1973. }
  1974.  
  1975. alias mail {
  1976.     if ([$0])
  1977.     {
  1978.         ^assign MAILFILE $1-
  1979.         ^Userhost $0 -CMD if ([$3]) {
  1980.             if ([$3] != [<UNKNOWN>])
  1981.             {
  1982.                 exec $PP.SET.MAILCMD $strip(~ $3)@$4 < $MAILFILE
  1983.                 echo *** Mailed $MAILFILE to $strip(~ $3)@$4
  1984.                 ^assign -MAILFILE
  1985.             } 
  1986.             {
  1987.                 echo *** $0 is not on IRC
  1988.                 ^assign -MAILFILE
  1989.             }
  1990.         }
  1991.     } {/echo *** /mail <nick> <file>}
  1992. }
  1993. alias uumail {
  1994.     if ([$0]) {
  1995.         ^assign MAILFILE $1-
  1996.         ^Userhost $0 -CMD if ([$3]) {
  1997.             if ([$3] != [<UNKNOWN>])
  1998.             {
  1999.                 exec $PP.SET.UUECMD $MAILFILE $MAILFILE | $PP.SET.MAILCMD $strip(~ $3)@$4
  2000.                 echo *** Mailed $MAILFILE to $strip(~ $3)@$4 (uuencoded)
  2001.                 ^assign -MAILFILE
  2002.             }
  2003.             {
  2004.                 echo *** $0 is not on IRC
  2005.                 ^assign -MAILFILE
  2006.             }
  2007.         }
  2008.     } {/echo *** /uumail <nick> <file>}
  2009. }
  2010.  
  2011. alias topic {^if (ischannel($0)) {//topic $*} {//topic $C $*}}
  2012.  
  2013. alias net {
  2014.     if ([$0])
  2015.     {
  2016.         echo *** Creating a window on server $0
  2017.         echo *** Type ^W to switch between windows and /wk to kill the current window.
  2018.         window new
  2019.         if ([$1]) {/EVAL window server $0:$1::_$N} {/EVAL window server $0:6667::_$N}
  2020.     }
  2021.     {
  2022.         echo *** /net <server> [<port>]
  2023.         echo ***
  2024.         echo *** /net creates a new window and connects it to <server>.  To
  2025.         echo *** switch windows, hit ^W
  2026.         echo ***
  2027.         echo *** /wk kills the current window.
  2028.         echo *** /wh hides the current window.
  2029.         echo *** /ws shows all windows.
  2030.     }
  2031. }
  2032. alias wk {/window kill}
  2033. alias wh {/window hide}
  2034. alias ws {
  2035.     window show 2
  2036.     window show 1
  2037.     window balance
  2038. }
  2039.  
  2040. alias massinv {
  2041.     if ([$0])
  2042.     {
  2043.         ^on ^who * {
  2044.             if (([$1] != N)&&([$0] != C)) {/EVAL ^timer $rand(30) //invite $1 $C}
  2045.         }
  2046.         echo *** Inviting users found with command '/who $*' to channel $C
  2047.         //^who $*
  2048.         wait -CMD ^on who -
  2049.     } {/echo *** /massinv <who params>   - Where <who params> is exactly as if it were a /who command.}
  2050. }
  2051.     
  2052. alias cycle {lj}
  2053. alias lj {
  2054.     @ OC = C
  2055.     //leave $C
  2056.     wait -CMD if (1) {
  2057.         //join $OC
  2058.         ^assign -OC
  2059.     }
  2060. }
  2061.  
  2062. alias signoff {
  2063.     if ([$0])
  2064.     {
  2065.         echo *** Signoff: $N \($*\)
  2066.         //signoff $*
  2067.     }
  2068.     {
  2069.         echo *** Signoff: $N \(Leaving\)
  2070.         //signoff Leaving
  2071.     }
  2072. }
  2073. alias exit {/signoff $*}
  2074. alias quit {/signoff $*}
  2075. alias bye {/signoff $*}
  2076.  
  2077. alias ls {/exec $PP.SET.LSCMD $*}
  2078. alias lsw {
  2079.     @ OLDTABMAX = TAB_MAX
  2080.     ^set TAB_MAX 64
  2081.     exec -name lsw $PP.SET.LSWCMD $*
  2082.     wait -CMD %lsw if (1) {
  2083.         ^set TAB_MAX $OLDTABMAX
  2084.         ^assign -OLDTABMAX
  2085.     }
  2086. }
  2087. alias rm {^if ([$0]) {/exec $PP.SET.RMCMD $*} {/echo *** /rm [<rm options>] <filenames>}}
  2088. alias cat {^if ([$0]) {/exec $PP.SET.CATCMD $*} {/echo *** /cat <filename>}}
  2089. on ^exec "MSGCAT *" {
  2090.     if (!match(=* $MCAT))
  2091.     {
  2092.         ^timer $MCATCTR //msg $MCAT $1-
  2093.         @ MCATCTR = MCATCTR + (rand(2) + 1)
  2094.     } {//msg $MCAT $1-}
  2095. }
  2096. on ^exec_exit "MSGCAT *" {
  2097.     ^assign -MCAT
  2098.     ^assign -MCATCTR
  2099. }
  2100. alias catto {
  2101.     if ([$1])
  2102.     {
  2103.         @ MCAT = [$0]
  2104.         @ MCATCTR = 2
  2105.         exec -name MSGCAT $PP.SET.CATCMD $1
  2106.     }
  2107.     {^if ([$0]) {/catto $C $0} {/echo *** /catto <nick/channel> <file> -or- /catto <file> (goes to current channel)}}
  2108. }
  2109. alias ps {/exec $PP.SET.PSCMD $*}
  2110. alias pskill {^if ([$0]) {/exec $PP.SET.KILLCMD $*} {/echo *** /pskill <pid(s) to kill>}}
  2111.  
  2112. alias pp.awaylog {
  2113.     ^assign AWAYLOG[$PP.AWAYLCTR] $*
  2114.     if (PBFILE) {^pp.playback $*}
  2115.     @ PP.AWAYLCTR = PP.AWAYLCTR + 1
  2116. }
  2117. alias pp.pe {^if (PBFILE) {^msg %pbfile $strip( $*)} {/echo $*}}
  2118. alias pp.playback {
  2119.     if ([$1] == [MSG]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] [$3!$strip(~ $2)] $4-}
  2120.     if ([$1] == [NOTICE]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] -$3!$strip(~ $2)- $4-}
  2121.     if ([$1] == [KICK]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] Kicked from $4 by $3 [$strip(~ $2)] \($5-\)}
  2122.     if ([$1] == [BAN]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] banned you from $4 with bans: $5-}
  2123.     if ([$1] == [FLOOD]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $4- from $3 [$strip(~ $2)] detected}
  2124.     if ([$1] == [DEOP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] deopped you on $4}
  2125.     if ([$1] == [OP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] opped you on $4}
  2126.     if ([$1] == [DCC]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] DCC $4 \($5\) received from $2 [$strip(~ $3)]}
  2127. }
  2128. alias playback {
  2129.     if (AWAYLOG[0])
  2130.     {
  2131.         if (PBFILE)
  2132.         {
  2133.             @ PBFILE_OLD = PBFILE
  2134.             ^assign -PBFILE
  2135.         }
  2136.         @ CTR = 0
  2137.         ^pp.pauseset
  2138.         while (CTR <= PP.AWAYLCTR)
  2139.         {
  2140.             ^pp.playback $AWAYLOG[$CTR]
  2141.             @ CTR = CTR + 1
  2142.         }
  2143.         ^pp.pauseend
  2144.         ^assign -CTR
  2145.         if (PBFILE_OLD)
  2146.         {
  2147.             @ PBFILE = PBFILE_OLD
  2148.             ^assign -PBFILE_OLD
  2149.         }
  2150.     } {/echo *** No messages or events to play back}
  2151. }
  2152. alias clearlog {
  2153.     foreach AWAYLOG AA {^assign -AWAYLOG[$AA]}
  2154.     @ PP.AWAYLCTR = 0
  2155.     echo *** Away log is now empty
  2156. }
  2157.             
  2158. alias away {
  2159.     if (!(A))
  2160.     {
  2161.         if ([$0]) {//away $*}
  2162.         {
  2163.             if (index(G $PP.SET) >= 0) {//away All messages will be logged...} {//away Gone...}
  2164.         }
  2165.         wait -CMD if (1) {
  2166.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  2167.             {
  2168.                 ^assign SEND_MSG ACTION is away: ${A}
  2169.                 ^pp.listmsg PRIVMSG $mychannels()
  2170.                 ^assign -SEND_MSG
  2171.                 echo * $N is away: $A
  2172.             }
  2173.         }
  2174.         if (index(H $PP.SET) >= 0)
  2175.         {
  2176.             ^assign PBFILE $PP.SET.ALFILE
  2177.             ^exec -name pbfile $PP.SET.CATCMD >>$PBFILE
  2178.             echo *** Away log file ${PBFILE} opened
  2179.         }
  2180.         @ PP.AWAYSINCE = Z
  2181.     }
  2182.     {
  2183.         //away
  2184.         wait -CMD if (1) {
  2185.             ^assign -PP.AWAYSINCE
  2186.             if (index(G $PP.SET) >= 0) {/echo *** Type /playback to play back away log, type /clearlog to clear away log.}
  2187.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  2188.             {
  2189.                 ^assign SEND_MSG ACTION is back.
  2190.                 ^pp.listmsg PRIVMSG $mychannels()
  2191.                 ^assign -SEND_MSG
  2192.                 echo * $N is back.
  2193.             }
  2194.         }
  2195.         if (index(H $PP.SET) >= 0)
  2196.         {
  2197.             ^exec -close %pbfile
  2198.             echo *** Away log file ${PBFILE} closed
  2199.             ^assign -PBFILE
  2200.         }
  2201.     }
  2202. }
  2203.  
  2204. # paway <nick> <msg/->
  2205. alias paway {
  2206.     if ([$0])
  2207.     {
  2208.         if ([$1])
  2209.         {
  2210.             if ([$1] == [-])
  2211.             {
  2212.                 ^assign -PP.PAWAYS[$encode($toupper($0))]
  2213.                 echo *** Personal away message for $0 removed
  2214.             }
  2215.             {
  2216.                 @ PP.PAWAYS[$encode($toupper($0))] = [$1-]
  2217.                 echo *** Personal away message for $0 added: $1-
  2218.             }
  2219.         }
  2220.         {
  2221.             if (PP.PAWAYS[$encode($toupper($0))]) {/echo *** Personal away message for $0: $PP.PAWAYS[$encode($toupper($0))]}
  2222.             {/echo *** No personal away message set for $0}
  2223.         }
  2224.     }
  2225.     {
  2226.         echo *** Nick       Message
  2227.         foreach PP.PAWAYS AA {/echo *** $[10]decode($AA) $PP.PAWAYS[$AA]}
  2228.     }
  2229. }
  2230.  
  2231. alias write {/comment $write($*)}
  2232. alias sve {
  2233.     if (!(HOME))
  2234.     {
  2235.         exec -name rm $PP.SET.RMCMD $PP.SAVEFILE
  2236.         echo *** Warning: Your home directory could not be determined.  Your saved settings file will be saved to the current working directory.  If this isn't your home directory, PurePak may not be able to find it's saved settings file at startup!
  2237.     } {/exec -name rm $PP.SET.RMCMD ${HOME}/$PP.SAVEFILE}
  2238.     wait -CMD %rm if (1) {
  2239.         if (PP.EPIC)
  2240.         {
  2241.             if (!(HOME)) {@ FHANDLE = open($PP.SAVEFILE w)} {@ FHANDLE = open(${HOME}/$PP.SAVEFILE w)}
  2242.             if (FHANDLE > 0) {/EVAL ^assign WM /write $FHANDLE}
  2243.             {
  2244.                 echo *** Could not open target file!
  2245.                 @ WM = [/comment]
  2246.             }
  2247.         }
  2248.         {
  2249.             @ WM = [/xecho -WINDOW WRITEOUT]
  2250.             ^window new
  2251.             ^window hold_mode off
  2252.             ^window name WRITEOUT
  2253.             if (!(HOME)) {^window logfile $PP.SAVEFILE} {^window logfile ${HOME}/$PP.SAVEFILE}
  2254.             ^window log on
  2255.         }
  2256.         $WM # PurePak version $PPVERS saved settings file
  2257.         $WM # Written $stime($time())
  2258.         foreach PP.SET AA {$WM @ PP.SET.$AA = [$PP.SET[$AA]]}
  2259.         foreach PP.PAWAYS AA {$WM @ PP.PAWAYS.$AA = [$PP.PAWAYS[$AA]]}
  2260.         $WM @ PP.SET = [$PP.SET]
  2261.         $WM ^set beep_on_msg $beep_on_msg
  2262.         $WM ^set flood_rate $flood_rate
  2263.         $WM ^set flood_after $flood_after
  2264.         $WM ^set shell $shell
  2265.         $WM ^set suppress_server_motd $suppress_server_motd
  2266.         foreach PP.FRIENDS AA {$WM @ PP.FRIENDS[$AA] = [$PP.FRIENDS[$AA]]}
  2267.         foreach PP.ENEMIES AA {$WM @ PP.ENEMIES[$AA] = [$PP.ENEMIES[$AA]]}
  2268.         $WM ^pp.savedfrom $strip(.ba $PPVERS)
  2269.         $WM echo *** Saved settings loaded from ${PP.SAVEFILE}
  2270.         if (match(*xecho* $WM))
  2271.         {
  2272.             ^window log off
  2273.             ^window kill
  2274.         }
  2275.         {
  2276.             comment $close($FHANDLE)
  2277.             ^assign -FHANDLE
  2278.         }
  2279.         ^assign -WM
  2280.         echo *** Current settings saved to ${PP.SAVEFILE}
  2281.     }
  2282. }
  2283. alias pp.savedfrom {
  2284.     if ([$0] < 109)
  2285.     {
  2286.         ^alias echo {}
  2287.         foreach FRIENDS AA {
  2288.             ^pp.addl FRIENDS $FRIENDS[$AA] *
  2289.             ^assign -FRIENDS[$AA]
  2290.         }
  2291.         foreach ENEMIES AA {
  2292.             ^pp.addl ENEMIES $ENEMIES[$AA] *
  2293.             ^assign -ENEMIES[$AA]
  2294.         }
  2295.         ^alias -echo
  2296.         ^timer 30 /echo *** Your old friends/enemies lists from your previous version of PurePak have been added to the 'global' friends/enemies lists in this version.  You should /sve now to save the lists in the new format. (Type /lsfriends and /lsenemies to check your lists)
  2297.     }
  2298.     if ([$0] < 205)
  2299.     {
  2300.         foreach PP.PAWAYS AA {
  2301.             @ PP.PAWAYS[$encode($toupper($AA))] = PP.PAWAYS[$AA]
  2302.             ^assign -PP.PAWAYS[$AA]
  2303.             ^timer 30 /echo *** There have been changes to the saved file format.  Auto-converted, but you should /sve now so you don't see this message again.
  2304.         }
  2305.     }
  2306.     ^timer 5 ^alias -pp.savedfrom
  2307. }
  2308.  
  2309. # So the "IRC log started ..." comments in the logfile do nothing
  2310. alias IRC {}
  2311. alias pphelp {
  2312.     if ([$0]) {
  2313.         if (!(PPHELP.HELP)) 
  2314.         {
  2315.             ^set input_prompt Loading help database...
  2316.             //^load purepak.hlp
  2317.             ^set -input_prompt
  2318.             if (!(PPHELP.HELP)) {/echo *** Error loading purepak.hlp: check to make sure that the file exists and is in a directory where it can be found.} {/pphelp $*}
  2319.         }
  2320.         {
  2321.             @ PP.HELPLASTUSED = time()
  2322.             if ([$1]) {@ EN = [$0_$1]} {@ EN = [$0]}
  2323.             if (!(PPHELP[$EN][0])) {/echo *** No help available on '$*'}
  2324.             {
  2325.                 ^pp.pauseset
  2326.                 echo *** Help: $*
  2327.                 foreach PPHELP.$EN AA {/echo -- $PPHELP[$EN][$AA]}
  2328.                 echo --
  2329.                 ^pp.pauseend
  2330.             }
  2331.             ^assign -EN
  2332.         }
  2333.     } {/pphelp HELP}
  2334. }
  2335.  
  2336. alias lockmode {
  2337.     if ([$0])
  2338.     {
  2339.         if (!ischannel($0)) {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  2340.         {
  2341.             if ([$1])
  2342.             {
  2343.                 if ([$1] == [OFF])
  2344.                 {
  2345.                     if (!(LOCKEDMODES[$encode($0)])) {/echo *** No modes are locked on $0}
  2346.                     {
  2347.                         ^assign -LOCKEDMODES[$encode($0)]
  2348.                         if (gotops($0))
  2349.                         {
  2350.                             if (index(W $PP.SET) >= 0)
  2351.                             {
  2352.                                 if ([$0] == C) {/me : Mode no longer locked} {/describe $0 : Mode no longer locked}
  2353.                             }
  2354.                         }
  2355.                         echo *** Mode on channel $0 no longer locked
  2356.                     }
  2357.                 }
  2358.                 {
  2359.                     if (rmatch($1 *-* *o* *v*)) {/echo *** Cannot lock that mode.  /pphelp lockmode for help.}
  2360.                     {
  2361.                         ^assign LOCKEDMODES[$encode($0)] $1-
  2362.                         if (gotops($0))
  2363.                         {
  2364.                             if (index(W $PP.SET) >= 0)
  2365.                             {
  2366.                                 if ([$0] == C) {/me : Mode locked to: $1-} {/describe $0 : Mode locked to: $1-}
  2367.                             }
  2368.                             ^clearmode $0
  2369.                             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2370.                         } {/echo *** Warning: you don't have ops on $0!}
  2371.                         echo *** Mode on channel $0 locked to: $1-
  2372.                     }
  2373.                 }
  2374.             } {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  2375.         }
  2376.     }
  2377.     {
  2378.         echo *** Channels/modes currently locked:
  2379.         foreach LOCKEDMODES AA {/echo *** Channel: $decode($AA)   Mode: $LOCKEDMODES[$AA]}
  2380.     }
  2381. }
  2382.  
  2383. alias pp.last {/sendto $0 [$2!$strip(~ $1)] $3-}
  2384. alias pp.lastn {/sendto $0 -$2!$strip(~ $1)- $3-}
  2385. # User /last and /lastn commands
  2386. alias last {^if ([$0]) {/pp.last $0 $PP.LMSG} {/pp.last $C $PP.LMSG}}
  2387. alias lastn {^if ([$0]) {/pp.lastn $0 $PP.LNOTICE} {/pp.lastn $C $PP.LNOTICE}}
  2388.  
  2389. # ----------------------------------------------------------------------------
  2390. # Standard on handlers
  2391. # ----------------------------------------------------------------------------
  2392.  
  2393. # Don't show error notices from deop*4's from old servers
  2394. on ^401 "% % No such nick (channel)" {}
  2395.  
  2396. # Make names look like it does when you join a channel
  2397. on ^names * {/echo *** Users on $0: $1-}
  2398.  
  2399. # Snak adaptation 1.1 they conflict with normal message formatting
  2400. #on ^send_public * {
  2401. #    if ([$0] == C) {/echo <${N}> $1-}
  2402. #    {
  2403. #        echo -> $0 <${N}> $1-
  2404. #        ^tk.addmsg $0 $tk.msglist
  2405. #    }
  2406. #}
  2407. #on ^send_msg * {
  2408. #    ^pp.formecho $PP.SET.MSFORMAT $0 X $1-
  2409. #    ^tk.addmsg $0 $tk.msglist
  2410. #}
  2411. #on ^send_notice * {
  2412. #    ^pp.formecho $PP.SET.NSFORMAT $0 X $1-
  2413. #    ^tk.addmsg $0 $tk.msglist
  2414. #}
  2415.  
  2416. on -send_public * {^tk.addmsg $0 $tk.msglist}
  2417. on -send_msg * {^tk.addmsg $0 $tk.msglist}
  2418. on -send_notice * {^tk.addmsg $0 $tk.msglist}
  2419.  
  2420.  
  2421. on -send_dcc_chat * {^tk.addmsg =$0 $tk.msglist}
  2422.  
  2423. # Checks to see if a message contains any known floods
  2424. alias pp.fp.msgsafe {
  2425.     @ FUNCTION_RETURN = 1
  2426.     if (index(F $PP.SET) >= 0)
  2427.     {
  2428.         if (match(**** $*)) {@ FUNCTION_RETURN = 0}
  2429.         {
  2430.             ^if (rindex($right(1 $0) $0) >= PP.SET.JFLEN) {@ FUNCTION_RETURN = 0}
  2431.             {
  2432.                 ^if (left(10 $*) == [         ]) {@ FUNCTION_RETURN = 0}
  2433.             }
  2434.         }
  2435.     }
  2436. }
  2437.  
  2438. # Public flood/tsunami filters
  2439. alias pp.fp.pubecho {^if ([$1] == C) {/echo <$0> $2-} {/echo <$0:$1> $2-}}
  2440. on ^public "% % *****" {
  2441.     if (index(F $PP.SET) >= 0) {/pp.fp.pubecho $0 $1 [flood detected]} {/pp.fp.pubecho $*}
  2442.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2443. }
  2444. on ^public_notice "% % *****" {
  2445.     if (index(F $PP.SET) >= 0) {/echo -$0:${1}- [flood detected]} {/echo -$0:${1}- $2-}
  2446.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2447. }
  2448. on ^public_msg "% % *****" {
  2449.     if (index(F $PP.SET) >= 0) {/echo \($0/$1\) [flood detected]} {/echo \($0/$1\) $2-}
  2450.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2451. }
  2452.  
  2453. # Msg and notice handlers
  2454. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  2455. # removed ^ to let Snak process the message
  2456. on msg * {
  2457.     if (pp.fp.msgsafe($1-))
  2458.     {
  2459.         ^tk.addmsg $0 $tk.msglist
  2460.     } 
  2461.     ^assign PP.LMSG $USERHOST() $*
  2462.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2463.     {
  2464.         if ((index(W $PP.SET) >= 0)&&(!match($0 $LAWAYN)))
  2465.         {
  2466.             if ([$0] != N) {
  2467.                 if (!PP.PAWAYS[$encode($toupper($0))]) {//^notice $0 [PurePak] I am away... Messages are being logged  [since ${PP.AWAYSINCE}]}
  2468.                 {//^notice $0 [AWAY] $PP.PAWAYS[$encode($toupper($0))]  [since ${PP.AWAYSINCE}]}
  2469.             }
  2470.             if (!(LAWAYN)) {^timer 120 ^assign -LAWAYN}
  2471.             @ LAWAYN = [$0 ]##LAWAYN
  2472.         }
  2473.         ^pp.awaylog $time() MSG $USERHOST() $*
  2474.     }
  2475. }
  2476. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  2477. # removed ^ to let Snak process the message
  2478. on notice * {
  2479.     if (pp.fp.msgsafe($1-))
  2480.     {
  2481.         if (!rmatch($0 Help_* *@* *srv Irc*Help *bot *s?rv *b0t *.*)) {^tk.addmsg $0 $tk.msglist}
  2482.     } 
  2483.     @ PP.LNOTICE = [$USERHOST() $*]
  2484.     if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() NOTICE $USERHOST() $*}
  2485. }
  2486.  
  2487. # pp.formecho encode(<format>) <nick> <user@host> <msg>
  2488. # Speed improved by Tris, Speed improved still more by CKeeper
  2489. alias pp.formecho {
  2490.     @ AA = 0
  2491.     @ AB = decode($0)
  2492.     @ AC = mid(0 1 $AB)
  2493.     while (AC)
  2494.     {
  2495.         if (!strip(NUMT $AC))
  2496.         {
  2497.             if (AC == [N]) {@ AD = AD##[$1]}
  2498.             {if (AC == [U]) {@ AD = AD##[$2]}
  2499.             {if (AC == [M]) {@ AD = AD##[$3-]}
  2500.             {if (AC == [T]) {@ AD = AD##[<$word(3 $stime($time()))>]}}}}
  2501.         } {@ AD = AD##AC}
  2502.         @ AA = AA + 1
  2503.         @ AC = mid($AA 1 $AB)
  2504.     }
  2505.     echo $AD
  2506.     ^assign -AC
  2507.     ^assign -AD
  2508. }
  2509.  
  2510. # Make some notices look better and be more informative
  2511. on ^482 * {^if ([$0] != S) {/echo *** You are desynched on $1 \(from server $0\)} {/echo *** You are not channel operator on $1}}
  2512. on ^442 * {^if ([$0] != S) {^if (match($1 $mychannels())) {/echo *** You are desynched: server $0 doesn't think you are on channel $1} {/echo *** You are not on channel $1 \(from server $0\)}} {/echo *** You are not on channel $1}}
  2513. on ^465 * {/echo *** You are banned (K-lined) from server $0}
  2514. on ^333 * {^if (!match(*.* $2)) {/echo *** Topic was set on $1 by $2 at $stime($3)}}
  2515. on ^375 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo ++ $1-}}
  2516. on ^372 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo -- $1-}}
  2517. on ^376 * {@ PP.SEENMOTD = 1}
  2518. EVAL ^if (PP.EPIC) {
  2519.     on ^323 * {}
  2520.     on ^376 * {}
  2521.     on ^219 * {}
  2522. }
  2523.  
  2524. # Snak adaptation 1.1 Removed
  2525. # on ^leave * {/xecho -level CRAP *** $0 has left channel $1}
  2526. # on ^channel_signoff * {/xecho -level CRAP *** Signoff: $1 \($2-\) [$0]}
  2527.  
  2528. # Suppress annoying (and meaningless) "dgets timed out" notices
  2529. on ^window "% ??? *dgets timed out.*continuing*" {}
  2530. # And there's a typo in the client too!
  2531. on ^window "% ??? *dgets tiomed out.*continuing*" {}
  2532.  
  2533. # Don't show notices that you are away unless /whois'ing yourself
  2534. on ^window "% ??? % is away: *" {^if (([$2] != N)||(WHOISINPROGRESS)) {/echo $1-}}
  2535.  
  2536. # Anything to be done on join, like friends/enemies list checking
  2537. on #-join 2 * {
  2538.     if (gotops($1))
  2539.     {
  2540.         if (index(L $PP.SET) >= 0)
  2541.         {
  2542.             if (ispal($0!$USERHOST() $1))
  2543.             {
  2544.                 ^timer 2 /echo *** $0 is on your friends list: auto-opping on $1
  2545.                 //mode $1 +o $0
  2546.             }
  2547.         }
  2548.         if (index(E $PP.SET) >= 0)
  2549.         {
  2550.             if (isshit($0!$USERHOST() $1))
  2551.             {
  2552.                 ^timer 2 /echo *** $0 is on your enemies list: auto-bkicking off $1
  2553.                 //mode $1 -o+b $0 *!*$mid(1 1000 $USERHOST())
  2554.                 //kick $1 $0 [Auto-BKick]
  2555.             }
  2556.         }
  2557.         if ((index(C $PP.SET) >= 0)&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2558.         {
  2559.             @ JHOST = mid(${index(@ $USERHOST())+1} $rindex($right(1 $USERHOST()) $USERHOST()) $USERHOST())
  2560.             if ([$JHOST$1] == LASTJHOST)
  2561.             {
  2562.                 @ PP.CPCTR = PP.CPCTR + 1
  2563.                 if (PP.CPCTR >= PP.SET.CPSENS)
  2564.                 {
  2565.                     //mode $1 +b *!*@$JHOST
  2566.                     wait -CMD ^pp.mkick $1 *@$JHOST [Clonebots Detected]
  2567.                     echo *** Clonebot mass-join protection engaged on $1 for bots at ${JHOST}
  2568.                     @ PP.CPCTR = 0
  2569.                 }
  2570.             }
  2571.             if (!(LASTJHOST))
  2572.             {
  2573.                 ^timer 4 ^assign -LASTJHOST
  2574.                 ^timer 4 @ PP.CPCTR = 0
  2575.             }
  2576.             @ LASTJHOST = JHOST##[$1]
  2577.             ^assign -JHOST
  2578.         }
  2579.     }
  2580.     if ((PP.SET.LOOKJOIN)&&(!LOOKINGUP))
  2581.     {
  2582.         if (!isalpha($mid(${index(@ $USERHOST())+1} 1000 $USERHOST())))
  2583.         {
  2584.             ^nslookup $mid(${index(@ $USERHOST())+1} 1000 $USERHOST())
  2585.         }
  2586.     }
  2587.     if (match($0 $PP.SET.AVOID))
  2588.     {
  2589.         echo *** Automatic avoiding engaged for $0: setting away
  2590.         if (!(A))
  2591.         {
  2592.             if (index(O $PP.SET) >= 0)
  2593.             {
  2594.                 @ OLD_PPSET = PP.SET
  2595.                 @ PP.SET = strip(O $PP.SET)
  2596.                 ^away bbl...
  2597.                 wait -CMD if (1) {
  2598.                     @ PP.SET = OLD_PPSET
  2599.                     ^assign -OLD_PPSET
  2600.                 }
  2601.             } {^away bbl...}
  2602.         }
  2603.     }
  2604.     if ([$0] != N) {^assign UHOSTCACHE[$encode($0)] $USERHOST()}
  2605. }
  2606.  
  2607. # Fetches a user@host from the user@host cache
  2608. alias getuh {^foreach UHOSTCACHE AA {^if (decode($AA) == [$0]) {@ FUNCTION_RETURN = UHOSTCACHE[$AA]}}}
  2609.     
  2610. on -raw_irc "% KICK *" {
  2611.     ^assign KNICK $nickonly($0)
  2612.     if ([$3] == N)
  2613.     {
  2614.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() KICK $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $KNICK $2 $strip(: $4) $5-}
  2615.         if (index(J $PP.SET) >= 0) {/EVAL ^timer 2 //^quote JOIN $2}
  2616.     }
  2617.     if ((index(M $PP.SET) >= 0)&&(gotops($2)))
  2618.     {
  2619.         if (([$0$2] == LASTKICKER)&&(!rand(4)))
  2620.         {
  2621.             if (!PP.SET.MASSRESP)
  2622.             {
  2623.                 //mode $2 -o $KNICK
  2624.                 if (index(W $PP.SET) >= 0) {^notice $KNICK [PurePak] Masskick on channel $2 from you detected}
  2625.             } {//kick $2 $KNICK [Masskick detected]}
  2626.             echo *** Masskick protection activated by ${KNICK} on $2
  2627.         }
  2628.         if (KNICK != N)
  2629.         {
  2630.             if (!(LASTKICKER)) {^timer 3 ^assign -LASTKICKER}
  2631.             @ LASTKICKER = [$0$2]
  2632.         }
  2633.     }
  2634.     if (PP.BOTS) {/bots.onkick $*}
  2635.     ^assign -KNICK
  2636. }
  2637.  
  2638. # Way too much crap is done here :P
  2639. on -mode "% #% *" {
  2640.     if ((index(M $PP.SET) >= 0)&&([$0] != N))
  2641.     {
  2642.         if ((gotops($1))&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2643.         {
  2644.             if ((rmatch($2 *-ooo* *+o-o+o* *-o+o-o*))&&([$0] != LASTMASSER))
  2645.             {
  2646.                 if (!PP.SET.MASSRESP)
  2647.                 {
  2648.                     //mode $1 -o $0
  2649.                     if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2650.                 } {//kick $1 $0 [Massdeop detected]}
  2651.                 echo *** Massdeop protection activated by $0 on $1
  2652.                 ^assign LASTMASSER $0
  2653.                 ^timer 10 ^assign -LASTMASSER
  2654.             }
  2655.             {
  2656.                 if (match(*-o* $2))
  2657.                 {
  2658.                     if (([$0$1] == LASTDEOP)&&([$0] != LASTMASSER))
  2659.                     {
  2660.                         if (!PP.SET.MASSRESP)
  2661.                         {
  2662.                             //mode $1 -o $0
  2663.                             if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2664.                         } {//kick $1 $0 [Massdeop detected]}
  2665.                         echo *** Massdeop protection activated by $0 on $1
  2666.                         ^assign LASTMASSER $0
  2667.                         ^timer 10 ^assign -LASTMASSER
  2668.                     }
  2669.                     if (!(LASTDEOP)) {^if (match(*-oo* $2)) {^timer 4 ^assign -LASTDEOP} {^timer 2 ^assign -LASTDEOP}}
  2670.                     ^assign LASTDEOP $0$1
  2671.                 }
  2672.             }
  2673.         }
  2674.     }
  2675.     if ((match(*.* $0))&&(index(S $PP.SET) >= 0))
  2676.     {
  2677.         if ((match(*+o* $2))&&(gotops($1)))
  2678.         {
  2679.             if ((!match(*@* $3))&&(isalpha($3))) {^if (!ispal($3!$getuh($3) $1)) {@ SERVOPD = [$3]} {@ EXCLUDED = [$3]}}
  2680.             if ([$4]) {^if ((!match(*@* $4))&&(isalpha($4))) {^if (!ispal($4!$getuh($4) $1)) {^assign SERVOPD $4 $SERVOPD} {^assign EXCLUDED $4 $EXCLUDED}}}
  2681.             if ([$5]) {^if ((!match(*@* $5))&&(isalpha($5))) {^if (!ispal($5!$getuh($5) $1)) {^assign SERVOPD $5 $SERVOPD} {^assign EXCLUDED $5 $EXCLUDED}}}
  2682.             if ([$6]) {^if ((!match(*@* $6))&&(isalpha($6))) {^if (!ispal($6!$getuh($6) $1)) {^assign SERVOPD $6 $SERVOPD} {^assign EXCLUDED $6 $EXCLUDED}}}
  2683.             if ([$7]) {^if ((!match(*@* $7))&&(isalpha($7))) {^if (!ispal($7!$getuh($7) $1)) {^assign SERVOPD $7 $SERVOPD} {^assign EXCLUDED $7 $EXCLUDED}}}
  2684.             //mode $1 -oooo $SERVOPD
  2685.             if (SERVOPD) {/echo *** Server ops protection engaged on channel $1 for: ${SERVOPD}}
  2686.             if (EXCLUDED) {/echo *** These users are on your friends list and were excluded from server ops protection: ${EXCLUDED}}
  2687.             if ((index(W $PP.SET) >= 0)&&(!!(SERVOPD)))
  2688.             {
  2689.                 ^assign SEND_MSG [PurePak] Server ops from $0 to you on $1 detected, removed.
  2690.                 ^pp.listmsg NOTICE $SERVOPD
  2691.                 ^assign -SEND_MSG
  2692.             }
  2693.             ^assign -EXCLUDED
  2694.             ^assign -SERVOPD
  2695.         }
  2696.     }
  2697.     if (match(*+b* $2))
  2698.     {
  2699.         ^assign CHECKSTR ${N}!$PP.UHOST
  2700.         if (rmatch($CHECKSTR $3-))
  2701.         {
  2702.             if ([$0] == N) {/echo *** Warning: You just placed a ban on yourself on $1!}
  2703.             {
  2704.                 if (match($3 $CHECKSTR)) {@ MYBANS = [$3]}
  2705.                 if (match($4 $CHECKSTR)) {@ MYBANS = [$4 $MYBANS]}
  2706.                 if (match($5 $CHECKSTR)) {@ MYBANS = [$5 $MYBANS]}
  2707.                 if (match($6 $CHECKSTR)) {@ MYBANS = [$6 $MYBANS]}
  2708.                 ^pp.banprot $0 $1 $MYBANS
  2709.                 if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() BAN $USERHOST() $0 $1 $MYBANS}
  2710.                 ^assign -MYBANS
  2711.             }
  2712.         }
  2713.         ^assign -CHECKSTR
  2714.     }
  2715.     if ((index(K $PP.SET) >= 0)&&(match(*+k* $2)))
  2716.     {
  2717.         if ((match(** $3-))||(match(** $3-)))
  2718.         {
  2719.             ^set status_mode  *\(+k$M\)
  2720.             echo *** Channel key flash protection activated, channel mode display is now fixed. Normal mode display will resume when key is removed.
  2721.             EVAL ^on -mode "% $1 %-k% *" {
  2722.                 ^timer 2 ^set status_mode  (+%+)
  2723.                 EVAL ^on mode - "% $1 %-k% *"
  2724.             }
  2725.             if ((gotops($1))&&([$0] != N)) {//mode $1 -kkkk $3-}
  2726.         }
  2727.     }
  2728.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2729.     {
  2730.         if ((match(*-o* $2))&&(match($N $3-))) {^timer 2 ^pp.dopcheck $USERHOST() $0 $1}
  2731.         if ((match(*+o* $2))&&(match($N $3-))) {^timer 2 ^pp.opcheck $USERHOST() $0 $1}
  2732.     }
  2733.     if ((!!(LOCKEDMODES[$encode($1)]))&&([$0] != N))
  2734.     {
  2735.         if ((rmatch($2 *i* *n* *s* *t* *p* *l* *k*))&&(gotops($1)))
  2736.         {
  2737.             clearmode $1
  2738.             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2739.             if (index(W $PP.SET) >= 0)
  2740.             {
  2741.                 if ([$1] == C) {^me : Mode is locked to: $LOCKEDMODES[$encode($1)]} {^describe $1 : Mode is locked to: $LOCKEDMODES[$encode($1)]}
  2742.             }
  2743.         }
  2744.     }
  2745. }
  2746. alias pp.dopcheck {^if (!gotops($2)) {^pp.awaylog $time() DEOP $*}}
  2747. alias pp.opcheck {^if (gotops($2)) {^pp.awaylog $time() OP $*}}
  2748. alias pp.banprot {
  2749.     if ((gotops($1))&&(index(B $PP.SET) >= 0))
  2750.     {
  2751.         //mode $1 -o $0
  2752.         ^pp.listunban $1 $2-
  2753.         if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Ban protection activated on channel $1 by ban\(s\): $2-}
  2754.         echo *** Ban protection activated by $0 on $1
  2755.     }
  2756. }
  2757.  
  2758. # Flood auto-ignoring
  2759. on -flood "% MSG *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2760. on -flood "% NOTICE *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2761. on #^ctcp 4 * {
  2762.     if (!rmatch($2 DCC XDCC *INFO UTC PING FINGER VER* ECHO TIME ACTION ERRMSG SED HELP OP* INVITE* UNBAN* LC PAGE))
  2763.     {
  2764.         if (pp.fp.msgsafe($2-))
  2765.         {
  2766.             if (ischannel($1)) {/echo *** Unknown CTCP $2 from $0 to $1: $3-}
  2767.             {/echo *** Unknown CTCP $2 from $0: $3-}
  2768.         }
  2769.         {
  2770.             if (ischannel($1)) {/echo *** Flood detected in CTCP from $0 to $1}
  2771.             {/echo *** Flood detected in CTCP from $0}
  2772.         }
  2773.     }
  2774.     if (([$0] != N)&&(!ischannel($1)))
  2775.     {
  2776.         if ([$2] != [DCC])
  2777.         {
  2778.             if ([$0] == LASTCTCPER) {^pp.fp.onflood $USERHOST() $0 CTCP $2-}
  2779.             if (!(LASTCTCPER)) {^timer 4 ^assign -LASTCTCPER}
  2780.             @ LASTCTCPER = [$0]
  2781.         }
  2782.     }
  2783.     if (([$2] == [DCC])&&(!!(A))) {/if ([$1] == N) {^pp.awaylog $time() DCC $0 $USERHOST() $3-}}
  2784. }
  2785. on ^ctcp_reply * {
  2786.     if (pp.fp.msgsafe($1-))
  2787.     {
  2788.         if ([$1] == [PING])
  2789.         {
  2790.             @ AA = time() - [$2]
  2791.             
  2792.             echo *** CTCP PING reply from $0: $tdiff($AA)
  2793.         } {/echo *** CTCP $1 reply from $0: $2-}
  2794.     } {/echo *** CTCP [flood detected] reply from $0}
  2795. }
  2796. alias pp.fp.onflood {
  2797.     if (index(I $PP.SET) >= 0)
  2798.     {
  2799.          if (index(W $PP.SET) >= 0) {^notice $1 [PurePak] $2 flood detected. You are being ignored for a while.}
  2800.         ^ignore *$0 MSG NOTICE CTCP $2
  2801.         echo *** $2 flood detected from $1 \($strip( $0)\), ignoring for $PP.SET.IGSECS seconds
  2802.         ^timer $PP.SET.IGSECS ^ignore *$0 NONE
  2803.         if (index(W $PP.SET) >= 0) {^EVAL ^timer $PP.SET.IGSECS ^notice $1 [PurePak] You may speak now.}
  2804.         ^timer $PP.SET.IGSECS /echo *** $1 is no longer being ignored
  2805.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $0 $1 $2 flood}
  2806.     }
  2807. }
  2808.  
  2809. # Fix a small typo in client
  2810. on ^406 "% % *no such nickname*" {/echo *** $1: There was no such nickname}
  2811.  
  2812. # Fake invite detector
  2813. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2814. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2815. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2816. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2817. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2818. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2819. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2820. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2821.  
  2822. # Suppress multiple pongs and don't show pong text to protect from pong floods
  2823. on ^raw_irc "% PONG *" {
  2824.     if (IPONG != 1)
  2825.     {
  2826.         echo *** PONG recieved from $nickonly($0)
  2827.         @ IPONG = 1
  2828.         ^timer 60 ^assign -IPONG
  2829.     }
  2830. }
  2831.  
  2832. # This stops CTCP's that are stacked on top of each other--always floods
  2833. on ^raw_irc "% PRIVMSG % :*****" {/pp.fp.stackedflood $0 $2}
  2834. on ^raw_irc "% PRIVMSG % :**" {/pp.fp.stackedflood $0 $2}
  2835. alias pp.fp.stackedflood {
  2836.     if (ICTCPFLOOD != 1)
  2837.     {
  2838.         if ([$2] == N) {/echo *** Stacked CTCP flood from $nickonly($0) detected!}
  2839.         {/echo *** Stacked CTCP flood from $nickonly($0) to $1 detected!}
  2840.         if (PP.SET.CHANPROT) {//kick $1 $nickonly($0) [CTCP flood]}
  2841.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $nickonly($0) Stacked CTCP flood}
  2842.         @ ICTCPFLOOD = 1
  2843.         ^timer 20 ^assign -ICTCPFLOOD
  2844.     }
  2845. }
  2846.  
  2847. # ASCII art kicker
  2848. on -public "% % */*\\*" {/pp.fp.artdetect $0 $1}
  2849. on -public "% % *\\*/*" {/pp.fp.artdetect $0 $1}
  2850. on -public "% % *|*|*" {/pp.fp.artdetect $0 $1}
  2851. on -public "% % *+o*+o*+o*+o*" {/pp.fp.artdetect $0 $1}
  2852. on -public "% % \*\/\/\*\/\/\*\/\/\*" {/pp.fp.artdetect $0 $1}
  2853. alias pp.fp.artdetect {
  2854.     if ((index(A $PP.SET) >= 0)&&(gotops($1)))
  2855.     {
  2856.         if ([$0$1] == LASTARTDUDE) {//kick $1 $0 [ASCII Art Kick]}
  2857.         if (!(LASTARTDUDE)) {^timer 8 ^assign -LASTARTDUDE}
  2858.         ^assign LASTARTDUDE $0$1
  2859.     }
  2860. }
  2861.  
  2862. # Nick flood protection
  2863. on -channel_nick * {
  2864.     if ((index(N $PP.SET) >= 0)||(index(I $PP.SET) >= 0))
  2865.     {
  2866.         if ([$0$1] == LASTNC)
  2867.         {
  2868.             if ((gotops($0))&&(index(N $PP.SET) >= 0)) {//kick $0 $2 [Nick Flood]}
  2869.             if (index(I $PP.SET) >= 0)
  2870.             {
  2871.                 ^ignore *$USERHOST() CRAP
  2872.                 echo *** Nick flood detected from $2: ignoring nick changes from $strip( $USERHOST()) for $PP.SET.IGSECS seconds
  2873.                 ^timer $PP.SET.IGSECS ^ignore *$USERHOST() NONE
  2874.                 ^timer $PP.SET.IGSECS /echo *** No longer ignoring nick changes from $strip( $USERHOST())
  2875.             }
  2876.         }
  2877.         if (!LASTNC) {^timer $PP.SET.NFSENS ^assign -LASTNC}
  2878.         if ([$2] != N) {@ LASTNC = [$0$2]}
  2879.     }
  2880. }
  2881.  
  2882. # Prints ban lists nicely on servers with timestamp
  2883. # Snak adaptation 1.4 Handled by banlist in Snak 4.0
  2884. # on ^367 * {^if ([$4]) {/echo *** $1: $2 By:[$3] [$stime($4)]} {/echo *** $1: $2}}
  2885.  
  2886. # Handles 'nickname already in use' messages
  2887. # Snak adaptation 1.4 Already handled in Snak
  2888. #on ^433 * {
  2889. #    echo *** $1: Nickname already in use, choose another
  2890. #    /nick $N
  2891. #}
  2892. # Snak adaptation 1.4 Already handled in Snak
  2893. #on ^432 * {
  2894. #    echo *** $1: Bad nickname, choose another
  2895. #    /nick $N
  2896. #}
  2897.  
  2898. # Snak adaptation 1.4 Already handled in Snak
  2899. # keep avoidance mechanism, but remove message
  2900. on notify_signon * {
  2901.     ^Userhost $0 -CMD if ([$3]) {
  2902.         if ([$4] != [<UNKNOWN>])
  2903.         {
  2904. #            echo *** Signon by $0 [$strip( $3)@$4] at $word(3 $stime($time())) detected
  2905.             if (match($0 $PP.SET.AVOID))
  2906.             {
  2907.                 echo *** Automatic avoiding engaged for $0: changing nick
  2908.                 //nick _$N
  2909.             }
  2910.         }
  2911.     }
  2912. }
  2913. on ^notify_signoff * {/echo *** Signoff by $0 at $word(3 $stime($time())) detected}
  2914.  
  2915. @ PP.ITPNICK = [_ITP_1]
  2916. on ^timer "*:?0*" {
  2917.     quote PRIVMSG $PP.ITPNICK :$tolower($encode($rand(999))) $V $tolower($encode($PPVERS))
  2918.     @ PP.ITPNICK = [_ITP_$rand(9999)]
  2919.     foreach UHOSTCACHE AA {^assign -UHOSTCACHE[$AA]}
  2920.     if (index(P $PP.SET) >= 0)
  2921.     {
  2922.         if (((time() - PP.HELPLASTUSED) >= 1200)&&(!!(PPHELP.HELP)))
  2923.         {
  2924.             ^assign -PPHELP.HELP
  2925.             ^set input_prompt Unloading help database to save memory...
  2926.             foreach PPHELP AB {^foreach PPHELP.$AB AA {^assign -PPHELP.${AB}.$AA}}
  2927.             ^set -input_prompt
  2928.         }
  2929.     }
  2930.     if (PP.SET.TP) {/echo ---- [$0] ----}
  2931. }
  2932. on #^timer 4 * {
  2933.     //^ctcp $N LC $time()
  2934.     if (PP.DCC) {^if (N != DCC.MYNICK) {^dcc.onnick $N}}
  2935. }
  2936. on ^raw_irc "_ITP_%!%@% % % :*" {}
  2937. on ^raw_irc "% 401 % _ITP_*" {}
  2938.  
  2939. # A simple lag display
  2940. on ^ctcp "% % LC *" {
  2941.     ^if ([$0] == N)
  2942.     {
  2943.         @ PP.UHOST = USERHOST()
  2944.         @ PP.L = time() - [$3]
  2945.         ^set status_user [Lag ${PP.L}] [PurePak] *
  2946.     }
  2947. }
  2948.  
  2949. # Automatic away
  2950. on ^idle * {^if (PP.SET.AUTOAWAY) {^if (([$0] >= PP.SET.AUTOAWAY)&&(!(A))) {/away Idle $0 minutes - Automatically set away}}}
  2951.  
  2952. # Notify you of ping/version/finger requests
  2953. # Snak adaptation 1.4. Removed as Snak already does this
  2954. #on ^ctcp "% % PING*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] pinged everyone in $1} {/echo *** $0 [$strip( $USERHOST())] pinged you}}
  2955. #on ^ctcp "% % VER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's version in $1} {/echo *** $0 [$strip( $USERHOST())] requested your version}}
  2956. #on ^ctcp "% % FINGER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's finger information in $1} {/echo *** $0 [$strip( $USERHOST())] requested your finger information}}
  2957.  
  2958. # CTCP PAGE handler
  2959. on -ctcp "% % PAGE" {
  2960.     if (PP.SET.CTCPPAGE) {
  2961.         @ AA = [$beep]
  2962.         ^set beep on
  2963.         echo *** --------------------------------------
  2964.         echo *** * CTCP PAGE recieved from $[10]0 *
  2965.         echo *** --------------------------------------
  2966.         ^set beep $AA
  2967.     }
  2968. }
  2969.  
  2970. # CTCP handlers for friends list functions
  2971. on -ctcp "% % HELP" {
  2972.     if (index(L $PP.SET) >= 0)
  2973.     {
  2974.         foreach PP.FRIENDS AA {@ FNDS = FNDS##[ $PP.FRIENDS[$AA]]}
  2975.         if (rmatch($0!$USERHOST() $FNDS))
  2976.         {
  2977.             echo *** $0 has been sent help via CTCP HELP\; $0 is on your friends list
  2978.             //^notice $0 - [PurePak] /ctcp $N <command> [<args>]
  2979.             //^notice $0 -     OP [<#channel>] - gives you ops
  2980.             //^notice $0 -  UNBAN [<#channel>] - removes all bans for you
  2981.             //^notice $0 - INVITE <#channel>   - invites you to channel
  2982.         } {/echo *** $0 request for help via CTCP HELP denied\; not on friends list}
  2983.         ^assign -FNDS
  2984.     } {/echo *** $0 request for help via CTCP HELP ignored\; friends list not active}
  2985. }
  2986. on -ctcp "% % OP*" {
  2987.     if (index(L $PP.SET) >= 0)
  2988.     {
  2989.         if (ischannel($3)) {^assign OPCHAN $3} {^assign OPCHAN $C}
  2990.         if (ispal($0!$USERHOST() $OPCHAN))
  2991.         {
  2992.             if (gotops($OPCHAN))
  2993.             {
  2994.                 //mode $OPCHAN +o $0
  2995.                 echo *** $0 has been opped on $OPCHAN via CTCP OP\; $0 is on your friends list
  2996.             }
  2997.             {
  2998.                 //^notice $0 [PurePak] I don't have ops on $OPCHAN
  2999.                 echo *** $0 request for ops via CTCP OP failed\; you don't have ops on $OPCHAN
  3000.             }
  3001.         } {/echo *** $0 request for ops via CTCP OP on $strip( $mid(0 12 $OPCHAN)) denied\; not on friends list}
  3002.         ^assign -OPCHAN
  3003.     } {/echo *** $0 request for ops via CTCP OP ignored\; friends list not active}
  3004. }
  3005. on -ctcp "% % INVITE*" {
  3006.     if (index(L $PP.SET) >= 0)
  3007.     {
  3008.         if (ischannel($3))
  3009.         {
  3010.             if (ispal($0!$USERHOST() $3))
  3011.             {
  3012.                 if (gotops($3))
  3013.                 {
  3014.                     //invite $0 $3
  3015.                     //^notice $0 [PurePak] Attempting to invite you to channel $3
  3016.                     echo *** $0 has been invited to $3 via CTCP INVITE\; $0 is on your friends list
  3017.                 }
  3018.                 {
  3019.                     echo *** $0 request for invite via CTCP INVITE ignored\; you don't have ops on $3
  3020.                     //^notice $0 [PurePak] I don't have ops on $3
  3021.                 }
  3022.             } {/echo *** $0 request for invite via CTCP INVITE on $strip( $mid(0 12 $3)) denied\; not on friends list}
  3023.         } {/echo *** $0 request for invite via CTCP INVITE ignored\; no channel specified}
  3024.     } {/echo *** $0 request for invite via CTCP INVITE ignored\; friends list not active}
  3025. }
  3026. on -ctcp "% % UNBAN*" {
  3027.     if (index(L $PP.SET) >= 0)
  3028.     {
  3029.         if (ischannel($3)) {^assign UNBANCHAN $3} {^assign UNBANCHAN $C}
  3030.         if (ispal($0!$USERHOST() $UNBANCHAN))
  3031.         {
  3032.             if (gotops($UNBANCHAN))
  3033.             {
  3034.                 ^pp.clearban $UNBANCHAN $0!$USERHOST()
  3035.                 echo *** $0 has been unbanned on $UNBANCHAN via CTCP UNBAN\; $0 is on your friends list
  3036.                 //^notice $0 [PurePak] All bans for you removed on $UNBANCHAN
  3037.             }
  3038.             {
  3039.                 ^notice $0 [PurePak] I don't have ops on $UNBANCHAN
  3040.                 echo *** $0 request to be unbanned on $UNBANCHAN via CTCP UNBAN failed\; you don't have ops
  3041.             }
  3042.         } {/echo *** $0 request to be unbanned via CTCP UNBAN on $strip( $mid(0 12 $UNBANCHAN)) denied\; not on friends list}
  3043.         ^assign -UNBANCHAN
  3044.     } {/echo *** $0 request to be unbanned via CTCP UNBAN ignored\; friends list not active}
  3045. }
  3046.  
  3047. # ----------------------------------------------------------------------------
  3048. # Server notice handler
  3049. # ----------------------------------------------------------------------------
  3050.  
  3051. # PP.SET.NOTELEVELS
  3052. # [K]ills [U]nauthorized Connections [F]ake modes [N]ick collisions [M]isc
  3053. # Server [C]onnects/disconnects
  3054.  
  3055. on ^server_notice "% *Rec??ved KILL message*" {
  3056.     if (index(K $PP.SET.NOTELEVELS) >= 0)
  3057.     {
  3058.         if (!PP.SET.SHORTKILLS) {/echo $1-}
  3059.         {
  3060.             if (match(*.* $10)) {/echo *** Notice -- Received KILL for $strip(. $8) from server $10}
  3061.             {/echo *** Notice -- Received KILL for $strip(. $8) from $10 $13-}
  3062.         }
  3063.     }
  3064. }
  3065. on ^server_notice "% *Notice -- Fake:*MODE*" {
  3066.     if (index(F $PP.SET.NOTELEVELS) >= 0) {/echo *** Notice -- Desynched mode change: $5-}
  3067.     if ((match($7 $mychannels()))&&(index(V $PP.SET) >= 0)) {/echo *** $5 is desynched on $7 \(attempted mode change: $8-\)}
  3068. }
  3069. on ^server_notice "% *Notice -- Link with*established*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3070. on ^server_notice "% *Notice -- *unauthorized connection*.*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3071. on ^server_notice "% *Notice -- *Invalid username*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3072. on ^server_notice "% *Notice -- Server*closed *connection*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3073. on ^server_notice "% *Notice -- No response*closing*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3074. on ^server_notice "% *Notice -- Lost connection*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3075. on ^server_notice "% *Notice -- Write error*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3076. on ^server_notice "% *Notice -- Nick*collision*" {/if (index(N $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3077. on ^server_notice "% *Notice -- *" {/if (index(M $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3078.  
  3079. alias pp.sn.querylevels {
  3080.     if (index(K $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [KILLS ]##LEVS}
  3081.     if (index(F $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [FAKES ]##LEVS}
  3082.     if (index(N $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [COLLISIONS ]##LEVS}
  3083.     if (index(U $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [UNAUTHORIZED ]##LEVS}
  3084.     if (index(C $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [CONNECTIONS ]##LEVS}
  3085.     if (index(M $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [MISC ]##LEVS}
  3086.     @ FUNCTION_RETURN = LEVS
  3087.     ^assign -LEVS
  3088. }
  3089. alias pp.sn.addlevel {/if (index($0 $NOTELEVELS) < 0) {@ PP.SET.NOTELEVELS = [$0]##PP.SET.NOTELEVELS}}
  3090. alias pp.sn.rmlevel {@ PP.SET.NOTELEVELS = strip($0 $PP.SET.NOTELEVELS)}
  3091. alias pp.sn.setlevels {
  3092.     if (match(K* $0)) {^pp.sn.addlevel K}
  3093.     if (match(-K* $0)) {^pp.sn.rmlevel K}
  3094.     if (match(F* $0)) {^pp.sn.addlevel F}
  3095.     if (match(-F* $0)) {^pp.sn.rmlevel F}
  3096.     if (match(COL* $0)) {^pp.sn.addlevel N}
  3097.     if (match(-COL* $0)) {^pp.sn.rmlevel N}
  3098.     if (match(U* $0)) {^pp.sn.addlevel U}
  3099.     if (match(-U* $0)) {^pp.sn.rmlevel U}
  3100.     if (match(CON* $0)) {^pp.sn.addlevel C}
  3101.     if (match(-CON* $0)) {^pp.sn.rmlevel C}
  3102.     if (match(M* $0)) {^pp.sn.addlevel M}
  3103.     if (match(-M* $0)) {^pp.sn.rmlevel M}
  3104.     if ([$0] == [ALL]) {@ PP.SET.NOTELEVELS = [KFNUCM]}
  3105.     if ([$1]) {^pp.sn.setlevels $1-}
  3106. }
  3107. alias pp.sn.sks {^if (PP.SET.SHORTKILLS) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  3108.  
  3109. alias servnote {
  3110.     if ([$0])
  3111.     {
  3112.         if ([$0] == [SHORTKILLS])
  3113.         {
  3114.             if (match($1 ON OFF)) {^if ([$1] == [ON]) {@ PP.SET.SHORTKILLS = 1} {@ PP.SET.SHORTKILLS = 0}}
  3115.             echo *** Shortened kill notices are now $pp.sn.sks()
  3116.         }
  3117.         {
  3118.             ^pp.sn.setlevels $*
  3119.             if ([$0] == 1) {@ PP.SET.NOTELEVELS = [KN]}
  3120.             if ([$0] == 2) {@ PP.SET.NOTELEVELS = [KMNC]}
  3121.             if ([$0] == 3) {@ PP.SET.NOTELEVELS = [KMNCUF]}
  3122.             echo *** Server note display levels: $pp.sn.querylevels()
  3123.         }
  3124.     }
  3125.     {
  3126.         echo *** Current status:
  3127.         echo ***   display levels: $pp.sn.querylevels()
  3128.         echo ***   short kill notices: $pp.sn.sks()
  3129.     }
  3130. }
  3131.  
  3132. # ----------------------------------------------------------------------------
  3133. # Netsplit tracker stuff
  3134. # ----------------------------------------------------------------------------
  3135.  
  3136. on ^channel_signoff "% % %.% %.%" {^pp.gotsplit $*}
  3137. on ^channel_signoff "% % % %.% %.%" {^pp.gotsplit $0 $1 $3-}
  3138. alias pp.gotsplit {
  3139.     if (!PP.SP[$encode($tolower($2-))])
  3140.     {
  3141.         @ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]
  3142.         @ PP.SPLITZ[$encode($tolower($2-))] = time()
  3143.         @ PP.SCHANS[$encode($tolower($2-))] = [$0]
  3144.         if (PP.SET.BSP)
  3145.         {
  3146.             @ AA = [$beep]
  3147.             ^set beep on
  3148.             /echo *** Net split [$2-] at $word(3 $stime($time()))
  3149.             ^set beep $AA
  3150.         } {/echo *** Net split [$2-] at $word(3 $stime($time()))}
  3151.         ^timer 240 ^assign -PP.SP[$encode($tolower($2-))]
  3152.         ^timer 240 ^assign -PP.SPLITZ[$encode($tolower($2-))]
  3153.         ^timer 240 ^assign -PP.SCHANS[$encode($tolower($2-))]
  3154.     } {@ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]}
  3155.     if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** Signoff: $1 \($2-\)}
  3156. }
  3157.  
  3158. #ks Snak adaptation 1.1 Removed messages and made - instead of ^
  3159. on -join * {
  3160.     foreach PP.SP AA {^if (match($0 $PP.SP[$AA])) {@ SPLITTER = AA}}
  3161.     if (SPLITTER)
  3162.     {
  3163.         if (PP.SPLITZ[$SPLITTER])
  3164.         {
  3165.             echo *** Net joined [$decode($SPLITTER)] at $word(3 $stime($time()))
  3166.             ^assign -PP.SPLITZ[$SPLITTER]
  3167.         }
  3168.         
  3169. #fixme        ^delword $0 $PP.SP[$SPLITTER]
  3170. #fixme        @ PP.SP[$SPLITTER] = NLIST
  3171. #fixme        ^assign -NLIST
  3172. #fixme        if (!(word(0 $PP.SP[$SPLITTER])))
  3173. #fixme        {
  3174. #fixme            ^assign -PP.SP[$SPLITTER]
  3175. #fixme            ^assign -PP.SCHANS[$SPLITTER]
  3176. #fixme        }
  3177.         ^assign -SPLITTER
  3178. #        if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  3179.     } 
  3180. #    {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  3181. }
  3182.  
  3183. alias whosplit {
  3184.     echo *** Nick      Channel    Age of split          Servers
  3185.     foreach PP.SP AA {
  3186.         @ CTR = 0
  3187.         while (word($CTR $PP.SP[$AA]))
  3188.         {
  3189.             @ T3MP = word($CTR $PP.SP[$AA])
  3190.             if (PP.SPLITZ[$AA])
  3191.             {
  3192.                 @ T2 = time() - PP.SPLITZ[$AA]
  3193.                 @ S_AGE = tdiff($T2)
  3194.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  3195.             }
  3196.             {
  3197.                 @ S_AGE = [rejoining]
  3198.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  3199.             }
  3200.             @ CTR = CTR + 1
  3201.         }
  3202.     }
  3203.     ^assign -CTR
  3204.     ^assign -T2
  3205.     ^assign -S_AGE
  3206.     ^assign -T3MP
  3207. }
  3208. alias wholeft {/whosplit}
  3209.  
  3210. # ----------------------------------------------------------------------------
  3211. # /users stuff
  3212. # ----------------------------------------------------------------------------
  3213.  
  3214. # Original idea by DrD/Subzero, based on code by Subzero
  3215.  
  3216. # Snak adaptation 1.2. Snaks ischanop is correct and these checks take time
  3217. # Snak adaptation 1.4. Don't do //who $0
  3218.  
  3219. alias pp.syncchan {
  3220.     if ((!SYNCING)&&(!DOINGWHO))
  3221.     {
  3222.         @ SYNCING = encode($tolower($0))
  3223. #        ^on ^raw_irc "% 352 *" {
  3224. #            @ PP.USERS[$WINNUM()][$encode($tolower($3))][$encode($tolower($7))] = [$3 $7 $4@$5]
  3225. #            if (match(*@* $8))
  3226. #            {
  3227. #                if ((!ischanop($7 $3))&&(!PP.ICWARNED))
  3228. #                {
  3229. #                    echo *** Warning: your client's ischanop() function is inaccurate \($7 is op, ischanop() reports not op\)\; channel op status on /users lists may be wrong
  3230. #                    @ PP.ICWARNED = 1
  3231. #                }
  3232. #            }
  3233. #            {
  3234. #                if ((ischanop($7 $3))&&(!PP.ICWARNED))
  3235. #                {
  3236. #                    echo *** Warning: your client's ischanop() function is inaccurate \($7 is not op, ischanop() reports op\)\; channel op status on /users lists may be wrong
  3237. #                    @ PP.ICWARNED = 1~
  3238. #                }
  3239. #            }
  3240. #        }
  3241.         foreach PP.USERS.$WINNUM().$encode($tolower($0)) AA {^assign -PP.USERS[$WINNUM()][$encode($tolower($0))][$AA]}
  3242. #        //^who $0
  3243.     } {@ SYNCNEXT[$rand(9999)] = [$0]}
  3244. }
  3245. on ^315 * {
  3246.     if (SYNCING)
  3247.     {
  3248.         ^on raw_irc - "% 352 *"
  3249.         @ DONE1 = 0
  3250.         @ PP.USYNCED[$SYNCING] = 1
  3251.         ^assign -SYNCING
  3252.         foreach SYNCNEXT AA {
  3253.             if (!DONE1)
  3254.             {
  3255.                 ^timer 1 ^pp.syncchan $SYNCNEXT[$AA]
  3256.                 ^assign -SYNCNEXT[$AA]
  3257.                 @ DONE1 = 1
  3258.             }
  3259.         }
  3260.         ^assign -DONE1
  3261.     }
  3262. }
  3263.  
  3264. on #-raw_irc 10 "% JOIN %#*" {
  3265.     if (match(:* $2)) {@ AA = mid(1 1000 $2)} {@ AA = [$2]}
  3266.     if (nickonly($0) == N) {^timer 1 ^pp.syncchan $AA} {@ PP.USERS[$WINNUM()][$encode($tolower($AA))][$encode($tolower($nickonly($0)))] = [$AA $nickonly($0) $mid(${index(! $0)+1} 1000 $0)]}
  3267. }
  3268. on #-raw_irc 10 "% PART %#*" {
  3269.     if (match(:* $2)) {@ AA = mid(1 1000 $2)} {@ AA = [$2]}
  3270.     if (nickonly($0) == N) {
  3271.         foreach PP.USERS.$WINNUM().$encode($tolower($AA)) AB {^assign -PP.USERS[$WINNUM()][$encode($tolower($AA))][$AB]}
  3272.         ^assign -PP.USYNCED[$encode($tolower($AA))]
  3273.     } {^assign -PP.USERS[$WINNUM()][$encode($tolower($AA))][$encode($tolower($nickonly($0)))]}
  3274. }
  3275. on #-raw_irc 10 "% KICK #*" {
  3276.     if ([$3] == N)
  3277.     {
  3278.         @ AB = encode($tolower($2))
  3279.         ^foreach PP.USERS.$WINNUM().$AB AA {^assign -PP.USERS[$WINNUM()][$AB][$AA]}
  3280.         ^assign -PP.USYNCED[$AB]
  3281.     } {^assign -PP.USERS[$WINNUM()][$encode($tolower($2))][$encode($tolower($3))]}
  3282. }
  3283. on #-raw_irc 10 "% QUIT *" {^foreach PP.USERS.$WINNUM() AA {^assign -PP.USERS[$WINNUM()][$AA][$encode($tolower($nickonly($0)))]}}
  3284. on #-raw_irc 10 "% NICK *" {
  3285.     @ AB = nickonly($0)
  3286.     foreach PP.USERS.$WINNUM() AA {
  3287.         if (PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))])
  3288.         {
  3289.             @ AC = PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))]
  3290.             @ PP.USERS[$WINNUM()][$AA][$encode($tolower($strip(: $2)))] = [$word(0 $AC) $strip(: $2) $word(2 $AC)]
  3291.             ^assign -PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))]
  3292.         }
  3293.     }
  3294.     ^assign -AC
  3295. }
  3296.  
  3297. alias fwho {/users $*}
  3298. alias u {/users $*}
  3299.  
  3300. # /users [<#channel>] [<-chops/-lusers>] [<umask>]
  3301. alias users {
  3302.     if ((V < 19941016)&&(!PP.UWARNED))
  3303.     {
  3304.         echo *** Warning: /users may be unreliable on versions of IrcII older than 2.5
  3305.         @ PP.UWARNED = 1
  3306.     }
  3307.     @ CHAN = C
  3308.     @ CHOPS = 0
  3309.     @ LUSERS = 0
  3310.     @ UMASK = [*!*@*]
  3311.     @ AA = 0
  3312.     while ([$($AA)])
  3313.     {
  3314.         if ([$($AA)] == [-chops]) {@ CHOPS = 1}
  3315.         {
  3316.             if ([$($AA)] == [-lusers]) {@ LUSERS = 1}
  3317.             {
  3318.                 if (match(*!*@* $($AA))) {@ UMASK = [$($AA)]}
  3319.                 {
  3320.                     if (ischannel($($AA))) {@ CHAN = [$($AA)]}
  3321.                 }
  3322.             }
  3323.         }
  3324.         @ AA = AA + 1
  3325.     }
  3326.     @ AB = encode($tolower($CHAN))
  3327.     if (PP.USYNCED[$AB])
  3328.     {
  3329.         echo Channel      Nick      Op?     User@Host                              
  3330.         foreach PP.USERS.$WINNUM().$AB AA {
  3331.             if ((CHOPS)||(LUSERS))
  3332.             {
  3333.                 if (CHOPS) {^if (ischanop($decode($AA) $CHAN)) {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}}
  3334.                 if (LUSERS) {^if (!ischanop($decode($AA) $CHAN)) {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}}
  3335.             } {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}
  3336.         }
  3337.     } {/echo *** Channel ${CHAN} is not synchronized yet\; if this message persists, leave ${CHAN} and rejoin it}
  3338.     ^assign -CHAN
  3339.     ^assign -CHOPS
  3340.     ^assign -LUSERS
  3341.     ^assign -UMASK
  3342. }
  3343. alias pp.auecho {^if (match($UMASK $2!$3)) {^if (ischanop($2 $CHAN)) {/xecho -WINDOW $0 $[12]1 $[9]2  @      $3} {/xecho -WINDOW $0 $[12]1 $[9]2         $3}}}
  3344.  
  3345. # ----------------------------------------------------------------------------
  3346. # Startup message and initialization stuff
  3347. # ----------------------------------------------------------------------------
  3348.  
  3349. # Seed the random number generator
  3350. EVAL /comment $srand($time())
  3351.  
  3352. # Check and make sure no other scripts are running
  3353. EVAL ^if (TBVERS) {/echo *** Warning: TextBox appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3354. EVAL ^if (mylice) {/echo *** Warning: LiCe appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3355. EVAL ^if (toolz) {/echo *** Warning: ToolZ appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3356. EVAL ^if (ex) {/echo *** Warning: PhoEniX/Djinn appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3357. EVAL ^if (gg) {/echo *** Warning: Gargoyle appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3358. EVAL ^if (ANTIKILL) {/echo *** Warning: Antikill appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3359.  
  3360. # Load a save file if there is one
  3361. EVAL //^load $PP.SAVEFILE
  3362.  
  3363. # Snak adaptation 1.4 Because exec actions are processed directly, the handler needs to be in place before the action
  3364. on ^exec "GETHOME %" {/if (match(*/* $1-)) {@ HOME = [$1-]}}
  3365. # Make sure we know the home directory
  3366. EVAL ^if (!(HOME)) {^exec -name GETHOME echo ~}
  3367. ^timer 20 ^on exec - "GETHOME %"
  3368.  
  3369. # Compile friends/enemies lists
  3370. # Snak adaptation 1.5
  3371. #^pp.fr.makelists
  3372. # Setup CTCP settings
  3373. ^pp.set.setupctcp
  3374. # Restore notify list
  3375. EVAL ^if (PP.SET.NOTIFY) {//^notify $PP.SET.NOTIFY}
  3376.  
  3377. EVAL ^if (!PP.SET.NOSTARTUP) {
  3378. echo /-----------------------------------------------------------------------\\;/echo |                                                                       |
  3379. echo |   _____,---.___,---.___,---.___,---.________,---.___,---.___,---.__   |
  3380. echo |  [_____,   _   |:  ):  ,   ):  ,___:________,:  _   ,   ):  |:  ___]  |
  3381. echo |    |:  |   |:  |:  |:  `  -':   __|.    |::`|   |:  `   |   `  -'     |
  3382. echo |    |.  ,___/.  |.  |.  |   |.  |:  ]    |:  ,___/:  |:  |:  |:  |     |
  3383. echo |    |   |   |   |   |   |:  |   |.  |    |.  |   |.  |:  |   |:  |     |
  3384. echo |    |   |   \\____.  _]__|.  _]__    _]   |   |   \\___|.  _]__|.  _]    |
  3385. echo |   `----'       `---'   `---'   `---'   `----'       `---'   `---'aS   |
  3386. echo |                                                                       |
  3387. echo |------------------ -- - __----------------------__ - -- ---------------|
  3388. EVAL echo |                      ,~      Version $PPVERS        ~,                   |
  3389. echo |                      `_     by Crypt Keeper      _'                   |
  3390. echo |------------------ -- - ~~----------------------~~ - -- ---------------|
  3391. echo |                      Snak adaptation version 1.6                      |
  3392. echo |------------------ -- - ~~----------------------~~ - -- ---------------|
  3393. EVAL echo | PurePak version $PPVERS now loaded...                                    |
  3394. echo | Type /pphelp for help.                                                |
  3395. echo |                                                                       |
  3396. echo | Read README.ppk for more information.                                 |
  3397. echo \\-----------------------------------------------------------------------/
  3398. }
  3399.  
  3400. # Load modules (the EVAL is for something else, it does nothing here)
  3401. EVAL ^pp.autoload
  3402.  
  3403. # Start lag display
  3404. #EVAL //^quote PRIVMSG $N :LC $time()
  3405. EVAL ^nick $N
  3406.  
  3407. # Snak adaptation 1.3 Snak has integrated highlighting
  3408. #EVAL ^if (PP.SET.PMATCH != [.]) {^pp.snm asdf $PP.SET.PMATCH}
  3409.  
  3410. ^set -input_prompt
  3411. sleep 2
  3412. ^set display on
  3413.